コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: DefaultTagCache.cs プロジェクト: adwardliu/Orchard2
        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;
        }