public void Unlock(string key)
        {
            int retry = _operationRetry;

            do
            {
                try
                {
                    _cache.Unlock(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")))
                    {
                        throw;
                    }

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

                    retry--;

                    if (_operationRetryDelayInterval > 0)
                    {
                        Thread.Sleep(_operationRetryDelayInterval);
                    }
                }
            }while (retry >= 0);
        }
Beispiel #2
0
        public void Unlock(string sessionId, string key)
        {
            object obj = null;

            Alachisoft.NCache.Web.Caching.Cache cache = null;

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