public void Remove(Type expectType, string name, bool promote = false) { if (expectType == null) { throw new ArgumentNullException(nameof(expectType)); } if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } ConcurrentDictionary <string, ICallSite> dict; using (GA.Locking(expectType)) { if (CacheTypeName.TryGetValue(expectType, out dict)) { ICallSite callSite; dict.TryRemove(name, out callSite); } } if (this._hasParent && promote) { this.Parent.Remove(expectType, name, promote); } }
/// <summary> /// 销毁所有的映射。 /// </summary> public virtual void DestroyAll() { CacheTypeName.Clear(); CacheName.Clear(); CacheType.Clear(); GC.WaitForFullGCComplete(); }
internal bool FindCallSite(Type expectType, string name, out ICallSite callSite) { ConcurrentDictionary <string, ICallSite> nameCallSites; if (CacheTypeName.TryGetValue(expectType, out nameCallSites) && nameCallSites.TryGetValue(name, out callSite)) { return(true); } callSite = null; return(false); }