/// <inheritdoc />
        public void AddExpiration(ExpiryToken <TKey> expiration)
        {
            IExpiryStashContracts.AddExpiration(this);

            if (this.awaitingTokensCount.Read() <= 0)
            {
                // not awaiting a token so store it for disposal later
                this.stash.AddExpiration(expiration);
            }
            else
            {
                // pool is empty and Take/TakeAsync is awaiting a value so dispose token immediately
                expiration.TryDisposeCacheValue();
            }
        }
Beispiel #2
0
        /// <inheritdoc />
        public void AddExpiration(ExpiryToken <TKey> expiration)
        {
            ICacheValueContracts.AddExpiration(this);

            expiration.TryDisposeCacheValue();
        }