Interface ILockableCacheProvider
public interface ILockableCacheProvider
Interface for cache providers which offer distributed locking functionality.
-
Method Summary
Modifier and TypeMethodDescriptionacquireLock(String lockKey, int acquireTimeoutMillis, int expiryTimeMillis) Acquire a distributed lock for the given key.voidreleaseLock(ILock lock) Release a distributed lock for the given key.booleanRenew a distributed lock for the given key.
-
Method Details
-
acquireLock
Acquire a distributed lock for the given key.- Parameters:
lockKey- The key to lock.acquireTimeoutMillis- The maximum time to wait to acquire the lock in milliseconds.expiryTimeMillis- The time after which the lock will expire in milliseconds.- Returns:
- An
ILockinstance representing the acquired lock.
-
renewLock
Renew a distributed lock for the given key.- Parameters:
expiryTimeMillis- The new expiry time for the lock in milliseconds.lockKey- The key to renew the lock for.- Returns:
- True if the lock was successfully renewed, false otherwise.
-
releaseLock
Release a distributed lock for the given key.- Parameters:
lock- The lock to release.
-