示例#1
0
        static SlimCacheManager()
        {
            _StaticCacheController = CacheControllerFactory.CreateCacheController();
            _Cache = MemoryCache.Default;

            CacheItemContainer container;

            foreach (ICacheItem item in _StaticCacheController.IterateOverCacheItems())
            {
                // get the global cachesettings
                if (item.LifeSpan.TotalMilliseconds <= 0)
                {
                    item.LifeSpan = _StaticCacheController.LifeSpanInterval;
                }

                if (item.LifeSpan == TimeSpan.Zero)
                {
                    throw new CachingException("Cache Configuration item with key " + item.Name + " has no expiry time specified. Either set the Seconds or Minutes value. It is allowed to set both values at a time.");
                }

                container = new CacheItemContainer(
                    item
                    , string.IsNullOrEmpty(item.CacheKey) ? item.Name : item.CacheKey);

                ContinuousCacheAccessSynchronizationManager.InitializeCacheItemSynchronizationController(container);
            }
        }