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 Detail

      • NEVER_EXPIRE

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

        static final long NEVER_REFRESH
        Indicates that an item should never refresh.
        See Also:
        Constant Field Values
    • Method Detail

      • 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.
      • 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