Ejemplo n.º 1
0
        /// <summary>
        /// 移除缓存,根据缓存键
        /// </summary>
        /// <param name="cacheKey">缓存键</param>
        public void Remove(string cacheKey)
        {
            Check.NotNullOrEmpty(cacheKey, nameof(cacheKey));
            WriteLog($"Remove : cacheKey = {cacheKey}");

            _memcachedClient.Remove(this.HandleCacheKey(cacheKey));
        }
Ejemplo n.º 2
0
        public void Remove(string key)
        {
            _client.Remove(key);

            if (Keys.Contains(key))
            {
                SyncKeys(Keys.Where(_ => _ != key).ToHashSet <string>());
            }
        }
Ejemplo n.º 3
0
        public ulong DecrementMyCounter(string reportName, ILambdaContext context)
        {
            ulong index = memcachedClient.Decrement($"{reportName}_GP_Count", 0, 1, this.expiration);

            context.Logger.Log($"DecrementMyCounter {index}");
            if (index == 0)
            {
                context.Logger.Log($"DecrementMyCounter Removed index == 0");
                memcachedClient.Remove($"{reportName}_GP_Count");
            }
            return(index);
        }
        public void Purge <TResult>(Expression <Func <T, TResult> > expression)
        {
            var methodInfo      = SymbolExtensions.GetMethodInfo(expression);
            var parameters      = SymbolExtensions.GetParameter(expression);
            var proxyExpression = new ProxyRequest <T, TResult>(methodInfo, parameters);

            var hash = proxyExpression.CreateHash();

            _client.Remove(hash);
        }
Ejemplo n.º 5
0
 public void InvalidateCacheItem(string cacheKey)
 {
     try
     {
         var sanitisedKey = SanitiseCacheKey(cacheKey);
         var success      = _client.Remove(sanitisedKey);
         if (!success)
         {
             _logger.WriteErrorMessage(string.Format("Unable to remove item from cache. CacheKey:{0}", sanitisedKey));
         }
     }
     catch (Exception ex)
     {
         _logger.WriteException(ex);
     }
 }
        public void DestroyAccessToken()
        {
            string hash;

            if (TryGetHashFromCookie(out hash))
            {
                _logger.Info("Destroying session: " + hash);

                _memcachedClient.Remove(hash);
                HttpContext.Current.Items.Remove(typeof(UserAccessToken));

                var cookie = new HttpCookie(_cookieName, "expired")
                {
                    Secure   = _useSecureCookie,   /* Ensures that this cookie is only used on SSL connections - this prevents Man-in-the-middle attacks */
                    HttpOnly = true,               /* Ensures that the cookie cannot be read from JavaScript - this prevents XSS attacks */
                    Expires  = DateTime.Now.AddYears(-1)
                };

                HttpContext.Current.Response.Cookies.Add(cookie);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Remove the specified cacheKey.
        /// </summary>
        /// <returns>The remove.</returns>
        /// <param name="cacheKey">Cache key.</param>
        public void Remove(string cacheKey)
        {
            ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));

            _memcachedClient.Remove(this.HandleCacheKey(cacheKey));
        }
 public static void Remove(IMemcachedClient client, string id)
 {
     client.Remove(DataPrefix + id);
     client.Remove(HeaderPrefix + id);
 }
Ejemplo n.º 9
0
 public bool Remove(string key)
 {
     return(mc.Remove(key));
 }
Ejemplo n.º 10
0
 public virtual void Remove <T>(string key)
 {
     memcachedClient.Remove(key);
 }
Ejemplo n.º 11
0
 public static void Remove(IMemcachedClient client, string id)
 {
     client.Remove(DataPrefix + id);
     client.Remove(HeaderPrefix + id);
 }
 public override void Remove(string key)
 {
     _client.Remove(key);
 }
 public static void Remove(IMemcachedClient client, string id)
 {
     //lock (padLock)
     //{
         client.Remove(DataPrefix + id);
         client.Remove(HeaderPrefix + id);
     //}
 }
Ejemplo n.º 14
0
 public void Remove(string key)
 {
     _client.Remove(key);
 }
Ejemplo n.º 15
0
 public bool Remove(string key)
 {
     return(_client.Remove(key));
 }
Ejemplo n.º 16
0
 public void Remove(string key)
 {
     cache.Remove(key);
 }
Ejemplo n.º 17
0
 public static bool Remove(string key)
 {
     return(Cache.Remove(key));
 }
 public void Delete(string id)
 {
     _client.Remove(GetKey(id));
 }
 public void RemoveItem(System.Web.HttpContext context, string id, object lockId)
 {
     client.Remove(id);
 }
Ejemplo n.º 20
0
 public bool Remove(string key)
 {
     return(_memcachedClient.Remove(key));
 }
 /// <summary>
 /// Function to remove an item from the output cache
 /// </summary>
 /// <param name="key">The unique identifier for the entry to remove from the output cache</param>
 public override void Remove(
     string key)
 {
     client.Remove(SanitizeKey(key));
 }
 public void Remove_Should_Fail()
 {
     Assert.False(client.Remove(GetUniqueKey()));
 }
Ejemplo n.º 23
0
        public void Remove(string key)
        {
            IMemcachedClient client = this.GetMemcachedClient();

            client.Remove(key);
        }