internal void HandleLockExpiry(object key)
        {
            log.Warn("An item was expired by the cache while it was locked (increase your cache timeout): {0}", key);
            long ts = cache.NextTimestamp() + cache.Timeout;
            // create new lock that times out immediately
            CacheLock @lock = CacheLock.Create(ts, NextLockId(), null);

            @lock.Unlock(ts);
            cache.Put(key, @lock);
        }
Beispiel #2
0
 /// <summary>
 /// decrement a lock and put it back in the cache
 /// </summary>
 private Task DecrementLockAsync(object key, CacheLock @lock, CancellationToken cancellationToken)
 {
     if (cancellationToken.IsCancellationRequested)
     {
         return(Task.FromCanceled <object>(cancellationToken));
     }
     try
     {
         //decrement the lock
         @lock.Unlock(Cache.NextTimestamp());
         return(Cache.PutAsync(key, @lock, cancellationToken));
     }
     catch (System.Exception ex)
     {
         return(Task.FromException <object>(ex));
     }
 }
Beispiel #3
0
 internal Task HandleLockExpiryAsync(object key, CancellationToken cancellationToken)
 {
     if (cancellationToken.IsCancellationRequested)
     {
         return(Task.FromCanceled <object>(cancellationToken));
     }
     try
     {
         log.Warn("An item was expired by the cache while it was locked (increase your cache timeout): {0}", key);
         long ts = Cache.NextTimestamp() + Cache.Timeout;
         // create new lock that times out immediately
         CacheLock @lock = CacheLock.Create(ts, NextLockId(), null);
         @lock.Unlock(ts);
         return(Cache.PutAsync(key, @lock, cancellationToken));
     }
     catch (System.Exception ex)
     {
         return(Task.FromException <object>(ex));
     }
 }
		internal void HandleLockExpiry( object key )
		{
			log.Warn( "An item was expired by the cache while it was locked (increase your cache timeout): " + key );
			long ts = cache.NextTimestamp() + cache.Timeout;
			// create new lock that times out immediately
			CacheLock @lock = new CacheLock( ts, NextLockId(), null );
			@lock.Unlock( ts );
			cache.Put( key, @lock );
		}
		/// <summary>
		/// decrement a lock and put it back in the cache
		/// </summary>
		private void DecrementLock( object key, CacheLock @lock )
		{
			//decrement the lock
			@lock.Unlock( cache.NextTimestamp() );
			cache.Put( key, @lock );
		}
 /// <summary>
 /// decrement a lock and put it back in the cache
 /// </summary>
 private void DecrementLock(object key, CacheLock @lock)
 {
     //decrement the lock
     @lock.Unlock(cache.NextTimestamp());
     cache.Put(key, @lock);
 }