示例#1
0
 public new void Remove(object key)
 {
     Logger.Log(
         "Removing item against key '" + key + "'",
         Microsoft.Extensions.Logging.LogLevel.Trace
         );
     _nCache.Remove(key.ToString());
 }
示例#2
0
 public object Remove(string key)
 {
     Alachisoft.NCache.Web.Caching.Cache cache = (Alachisoft.NCache.Web.Caching.Cache)_caches[_primaryCache];
     if (cache != null)
     {
         return(cache.Remove(key));
     }
     else
     {
         return(null);
     }
 }
示例#3
0
        public object Remove(string key, bool enableRetry)
        {
            object value = null;
            int    retry = _operationRetry;

            do
            {
                try
                {
                    value = _cache.Remove(key);
                    break;
                }
                catch (Exception ex)
                {
                    string message = ex.Message;

                    if (message != null && !(message.ToLower().Contains("connection with server") ||
                                             message.ToLower().Contains("no server is available")) || !enableRetry)
                    {
                        throw;
                    }

                    if (retry <= 0)
                    {
                        throw ex;
                    }

                    retry--;

                    if (_operationRetryDelayInterval > 0)
                    {
                        Thread.Sleep(_operationRetryDelayInterval);
                    }
                }
            }while (retry >= 0);

            return(value);
        }
示例#4
0
        public object Remove(string sessionId, string key, bool enableRetry)
        {
            Alachisoft.NCache.Web.Caching.Cache cache = null;
            object obj = null;

            _sync.AcquireReaderLock(Timeout.Infinite);
            try
            {
                GetCache(sessionId, key, out obj, "", "", out cache, false);
                if (cache != null)
                {
                    return(cache.Remove(key));
                }
            }
            finally
            {
                _sync.ReleaseReaderLock();
            }
            return(null);
        }