/// <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(); } }
/// <summary> /// Clears the cache. /// </summary> public void Clear( ) { if (InnerCache != null) { InnerCache.Clear( ); } if (!RedisCacheMemoryStoreSuppressionContext.IsSet(CacheName)) { _memoryStore.KeyDeletePrefix(CacheName); } }
public void ClearCache() { InnerCache.Clear(); }