Пример #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();
            }
        }
Пример #2
0
        /// <summary>
        ///     Clears the cache.
        /// </summary>
        public void Clear( )
        {
            if (InnerCache != null)
            {
                InnerCache.Clear( );
            }

            if (!RedisCacheMemoryStoreSuppressionContext.IsSet(CacheName))
            {
                _memoryStore.KeyDeletePrefix(CacheName);
            }
        }
Пример #3
0
 public void ClearCache()
 {
     InnerCache.Clear();
 }