Example #1
0
        public override CacheItem AddOrGetExisting(CacheItem value, CacheItemPolicy policy)
        {
            var item = PrimaryCache.AddOrGetExisting(value, policy);

            //queue up writing to secondary cache on another thread
            ThreadPool.QueueUserWorkItem(_ => SecondaryCache.AddOrGetExisting(PrimaryCache.GetCacheItem(value.Key), policy));

            return(item);
        }
Example #2
0
        public override object AddOrGetExisting(string key, object value, DateTimeOffset absoluteExpiration, string regionName = null)
        {
            var item = PrimaryCache.AddOrGetExisting(key, value, absoluteExpiration, regionName);

            //queue up writing to secondary cache on another thread
            ThreadPool.QueueUserWorkItem(_ => SecondaryCache.AddOrGetExisting(key, PrimaryCache.Get(key), absoluteExpiration, regionName));

            return(item);
        }
Example #3
0
        public override object AddOrGetExisting(string key, object value, CacheItemPolicy policy, string regionName = null)
        {
            var item = PrimaryCache.AddOrGetExisting(key, value, policy, regionName);

            //queue up writing to secondary cache on another thread
            ThreadPool.QueueUserWorkItem(_ => SecondaryCache.AddOrGetExisting(key, PrimaryCache.Get(key), policy, regionName));

            return(item);
        }