using System; using System.Threading.Tasks; namespace PhoenixLib.DAL.Redis.Locks { public interface IExpirableLockService { /// /// Sets a key without increment with a defined expiration date /// /// /// /// true if the key already exist Task TryAddTemporaryLockAsync(string key, DateTime expirationDate); /// /// Sets an incremental key with a defined maxValue, expires on the specified expirationDate /// /// /// /// /// Task<(bool, int newValue)> TryIncrementTemporaryLockCounter(string key, int maxValue, DateTime expirationDate); /// /// Try getting the current value of the counter /// /// /// Task<(bool, int newValue)> TryGetTemporaryCounterValue(string key); /// /// Removes a key if exists /// /// /// true if the key exists and got removed Task TryRemoveTemporaryLock(string key); /// /// Checks if a key exists /// /// /// true if the key exists Task ExistsTemporaryLock(string key); } }