private void RemoveSite(Site siteItem) { if (ContainsSite(siteItem)) { //Refresh Information InnerCache.Remove(siteItem.Name); } }
/// <summary> /// Caches the entry invalidate internal. /// </summary> /// <param name="username">The username.</param> public void CacheEntryInvalidateInternal(string username) { if (_innerCache != null) { lock ( _innerLockObject ) { InnerCache.Remove(username); } } }
protected async Task InvalidateAsync(string partitionKey) { await Task.Run(() => { if (InnerCache.TryGetValue(partitionKey, out HashSet <string> index)) { Parallel.ForEach(index, InnerCache.Remove); InnerCache.Remove(partitionKey); } }); }
/// <summary> /// Removes the specified key's cache value. /// </summary> /// <param name="key">The key.</param> /// <returns> /// True if the value was removed; False otherwise. /// </returns> public bool Remove(TKey key) { bool result = true; if (!RedisCacheMemoryStoreSuppressionContext.IsSet(CacheName)) { result = _memoryStore.KeyDelete(GetRedisKey(key)); } if (InnerCache != null) { result = InnerCache.Remove(key); } return(result); }
/// <summary> /// Removes the specified key's cache value. /// </summary> /// <param name="keys"></param> /// <returns> /// True if the value was removed; False otherwise. /// </returns> public IReadOnlyCollection <TKey> Remove(IEnumerable <TKey> keys) { TKey[] keyArray = keys.ToArray( ); bool[] result; if (!RedisCacheMemoryStoreSuppressionContext.IsSet(CacheName)) { RedisKey[] redisKeys = keyArray.Select(GetRedisKey).ToArray( ); result = _memoryStore.KeyDelete(redisKeys); } else { result = new bool[keyArray.Length]; for (int i = 0; i < result.Length; i++) { result[i] = true; } } if (InnerCache != null) { return(InnerCache.Remove(keyArray)); } var removedKeys = new List <TKey>( ); for (int i = 0; i < result.Length; i++) { if (result[i]) { removedKeys.Add(keyArray[i]); } } return(removedKeys.AsReadOnly( )); }
/// <summary> /// remove data with specific key from Sitecore Cache /// </summary> /// <param name="key"></param> public void RemoveData(object key) { InnerCache.Remove(key); }
public void Remove(TKey key) { InnerCache.Remove(key.ToString()); }
/// <summary> /// Removes the specified keys' cache values. /// </summary> /// <param name="keys">The keys.</param> /// <returns> /// Keys that were actually removed. /// </returns> public IReadOnlyCollection <TKey> Remove(IEnumerable <TKey> keys) { return(InnerCache.Remove(keys)); }
/// <summary> /// Removes the specified key's cache value. /// </summary> /// <param name="key">The key.</param> /// <returns> /// True if the value was removed; False otherwise. /// </returns> public bool Remove(TKey key) { return(InnerCache.Remove(key)); }