Interface DistributedCache.DistributedLock

All Superinterfaces:
AutoCloseable
Enclosing interface:
DistributedCache<K,V>

public static interface DistributedCache.DistributedLock extends AutoCloseable
Handle for a distributed lock. 分布式锁的句柄。
Since:
JDK 25, opencode-base-cache V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Releases the lock.
    boolean
    Extends the lock TTL.
    key()
    Gets the lock key.
    Gets the lock token (for verification).
  • Method Details

    • key

      Object key()
      Gets the lock key. 获取锁键。
      Returns:
      the result | 结果
    • token

      String token()
      Gets the lock token (for verification). 获取锁令牌(用于验证)。
      Returns:
      the result | 结果
    • extend

      boolean extend(Duration ttl)
      Extends the lock TTL. 延长锁 TTL。
      Parameters:
      ttl - the ttl | ttl
      Returns:
      the result | 结果
    • close

      void close()
      Releases the lock. 释放锁。
      Specified by:
      close in interface AutoCloseable