Interface BootCache

All Known Implementing Classes:
BootCache_RedisImple

public interface BootCache
Author:
Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    debounced(String key, String unlockPassword, int ttlMinute)
     
    default long
    flashsaleAcquireQuota(String itemId, long requestAmount)
    flash sale - order competition before reducing inventory
    default void
    flashsaleEnable(String itemId, boolean isEnabled)
    flash sale - enable
    default boolean
    flashsaleInventoryInit(String itemId, long totalAmount, long limit)
    flash sale - init inventory
    default FlashSale
    flash sale - inventory report
    default long
    flashsaleRevokeQuota(String itemId, long requestAmount)
    flash sale - revoke an order (undo order competition, normally happens when failed to pay within N minutes)
    default String
     
    boolean
    tryLock(String lockName, String unlockPassword, long millisecondsToExpireIncaseUnableToUnlock)
    this is a Distributed non-blocking version of lock() method; it attempts to acquire the lock immediately, return true if locking succeeds
    boolean
    unlock(String lockName, String unlockPassword)
    unlocks the Distributed Lock instance
  • Method Details

    • tryLock

      boolean tryLock(String lockName, String unlockPassword, long millisecondsToExpireIncaseUnableToUnlock)
      this is a Distributed non-blocking version of lock() method; it attempts to acquire the lock immediately, return true if locking succeeds
      Parameters:
      lockName - the name of the tryLock
      unlockPassword - unlockPassword is to be used for unlock. To protect a tryLock from being unlocked by anyone, a tryLock cannot be released when unlockPassword not match
      millisecondsToExpireIncaseUnableToUnlock - expire time of tryLock in case unable to unlock (e.g. exception/error before executing unlock)
      Returns:
      the result of get tryLock
    • unlock

      boolean unlock(String lockName, String unlockPassword)
      unlocks the Distributed Lock instance
      Parameters:
      lockName - the name of the tryLock
      unlockPassword - to ensure only the owner is able to unlock, success only when this value equals the unlockPassword specified by tryLock
      Returns:
      the result of get release
    • generateUnlockPassword

      default String generateUnlockPassword()
    • debounced

      default boolean debounced(String key, String unlockPassword, int ttlMinute)
      Parameters:
      key -
      unlockPassword -
      ttlMinute -
      Returns:
      true when debounced
    • flashsaleEnable

      default void flashsaleEnable(String itemId, boolean isEnabled)
      flash sale - enable
      Parameters:
      itemId -
      isEnabled - sale enabled if true, else disabled
    • flashsaleInventoryInit

      default boolean flashsaleInventoryInit(String itemId, long totalAmount, long limit)
      flash sale - init inventory
      Parameters:
      itemId -
      totalAmount - total inventory
      limit - max orderAmount per order
      Returns:
      true if success
    • flashsaleAcquireQuota

      default long flashsaleAcquireQuota(String itemId, long requestAmount)
      flash sale - order competition before reducing inventory
      Parameters:
      itemId -
      requestAmount -
      Returns:
      confirmed order amount
    • flashsaleRevokeQuota

      default long flashsaleRevokeQuota(String itemId, long requestAmount)
      flash sale - revoke an order (undo order competition, normally happens when failed to pay within N minutes)
      Parameters:
      itemId -
      requestAmount -
      Returns:
      the updated inventory booked amount
    • flashsaleInventoryReport

      default FlashSale flashsaleInventoryReport(String itemId)
      flash sale - inventory report
      Parameters:
      itemId -
      Returns: