Interface CacheItem

All Known Implementing Classes:
CacheItemImpl

public interface CacheItem
Provides information about an item residing in the cache.
Author:
Sumer Jabri, Alfonso Vásquez
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Indicates that an item should never expire.
    static final long
    Indicates that an item should never refresh.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the item's key, used to identify the item within the cache.
    Returns the CacheLoader used to refresh this item.
    Returns the additional parameters required by the CacheLoader.load(Object...) method.
    Returns the item's scope.
    long
    Returns the number of ticks that had passed at the moment the item was created.
    long
    Returns the number of ticks that are required for the item to expire.
    long
    Returns the number of ticks the are required for the item to be refreshed.
    Returns the item's value.
    boolean
    isExpired(long currentTicks)
    Returns true if the item has expired according to the number of ticks specified.
    boolean
    needsRefresh(long currentTicks)
    Returns true if the item needs to be refreshed according to the number of ticks specified.
  • Field Details

    • NEVER_EXPIRE

      static final long NEVER_EXPIRE
      Indicates that an item should never expire.
      See Also:
    • NEVER_REFRESH

      static final long NEVER_REFRESH
      Indicates that an item should never refresh.
      See Also:
  • Method Details

    • getScope

      String getScope()
      Returns the item's scope.
    • getKey

      Object getKey()
      Returns the item's key, used to identify the item within the cache.
    • getValue

      Object getValue()
      Returns the item's value.
    • getTicksAtCreation

      long getTicksAtCreation()
      Returns the number of ticks that had passed at the moment the item was created.
    • getTicksToExpire

      long getTicksToExpire()
      Returns the number of ticks that are required for the item to expire.
    • getTicksToRefresh

      long getTicksToRefresh()
      Returns the number of ticks the are required for the item to be refreshed.
    • getLoader

      CacheLoader getLoader()
      Returns the CacheLoader used to refresh this item.
    • getLoaderParams

      Object[] getLoaderParams()
      Returns the additional parameters required by the CacheLoader.load(Object...) method.
    • isExpired

      boolean isExpired(long currentTicks)
      Returns true if the item has expired according to the number of ticks specified.
      Parameters:
      currentTicks - the current number of ticks
      Returns:
      true if the item has expired according to the number of ticks specified, false otherwise
    • needsRefresh

      boolean needsRefresh(long currentTicks)
      Returns true if the item needs to be refreshed according to the number of ticks specified.
      Parameters:
      currentTicks - the current number of ticks
      Returns:
      true if the item needs to be refreshed according to the number of ticks specified, false otherwise