Class CacheItem

java.lang.Object
org.casbin.jcasbin.persist.cache.CacheItem

public class CacheItem extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    CacheItem(boolean value, Duration ttl)
    Constructs a CacheItem with a specified value and time-to-live (ttl).
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Retrieves the cached value.
    boolean
    Checks whether the cache item has expired based on the current time and its ttl.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CacheItem

      public CacheItem(boolean value, Duration ttl)
      Constructs a CacheItem with a specified value and time-to-live (ttl).
      Parameters:
      value - The boolean value to be cached.
      ttl - The duration for which this item should remain in the cache.
  • Method Details

    • isExpired

      public boolean isExpired()
      Checks whether the cache item has expired based on the current time and its ttl.
      Returns:
      True if the cache item is expired, false otherwise.
    • getValue

      public boolean getValue()
      Retrieves the cached value.
      Returns:
      The boolean value stored in this cache item.