Esempio n. 1
0
        /// <summary>
        /// Remove all items from the cache.
        /// </summary>
        public void Clear()
        {
            if (!RedisCacheMessageSuppressionContext.IsSet(Name))
            {
                if (IsolateTenants)
                {
                    var message = new RedisPubSubPerTenantCacheMessage <TKey>(new PerTenantCacheMessage <RedisPubSubCacheMessage <TKey> >(new RedisPubSubCacheMessage <TKey>(RedisPubSubCacheMessageAction.Clear)));

                    PerTenantChannel.Publish(message,
                                             PublishOptions.FireAndForget,
                                             true,
                                             RedisPubSubCacheHelpers.PerTenantMergeAction
                                             );
                }
                else
                {
                    Channel.Publish(
                        new RedisPubSubCacheMessage <TKey>(RedisPubSubCacheMessageAction.Clear),
                        PublishOptions.FireAndForget,
                        true,
                        RedisPubSubCacheHelpers.MergeAction
                        );
                }
            }

            using (new RedisCacheMessageSuppressionContext(Name))
            {
                InnerCache.Clear();
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     Clears the cache.
        /// </summary>
        public void Clear( )
        {
            if (InnerCache != null)
            {
                InnerCache.Clear( );
            }

            if (!RedisCacheMemoryStoreSuppressionContext.IsSet(CacheName))
            {
                _memoryStore.KeyDeletePrefix(CacheName);
            }
        }
Esempio n. 3
0
 public void ClearCache()
 {
     InnerCache.Clear();
 }