private void RemoveSite(Site siteItem)
 {
     if (ContainsSite(siteItem))
     {
         //Refresh Information
         InnerCache.Remove(siteItem.Name);
     }
 }
Exemplo n.º 2
0
 /// <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);
         }
     }
 }
Exemplo n.º 3
0
        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);
                }
            });
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
        /// <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);
 }
Exemplo n.º 7
0
 public void Remove(TKey key)
 {
     InnerCache.Remove(key.ToString());
 }
Exemplo n.º 8
0
 /// <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));
 }
Exemplo n.º 9
0
 /// <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));
 }