public DefaultTagCache(ITagRemovedEventHandler tagRemovedEventHandler, IMemoryCache memoryCache) { // We use the memory cache as the state holder and keep this class transient as it has // dependencies on non-singletons if (!memoryCache.TryGetValue(CacheKey, out _dictionary)) { _dictionary = new ConcurrentDictionary <string, HashSet <string> >(StringComparer.OrdinalIgnoreCase); memoryCache.Set(CacheKey, _dictionary); } _tagRemovedEventHandler = tagRemovedEventHandler; }
public DefaultTagCache(ITagRemovedEventHandler tagRemovedEventHandler, IMemoryCache memoryCache) { // We use the memory cache as the state holder and keep this class transient as it has // dependencies on non-singletons if(!memoryCache.TryGetValue(CacheKey, out _dictionary)) { _dictionary = new ConcurrentDictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase); memoryCache.Set(CacheKey, _dictionary); } _tagRemovedEventHandler = tagRemovedEventHandler; }