Class CacheEntry<T extends Cacheable>

java.lang.Object
org.deltava.util.cache.CacheEntry<T>
Type Parameters:
T - the cacheable object type
All Implemented Interfaces:
Serializable, Comparable<CacheEntry<T>>
Direct Known Subclasses:
AgingCache.AgingCacheEntry, ExpiringCacheEntry, RemoteCacheEntry

abstract class CacheEntry<T extends Cacheable> extends Object implements Serializable, Comparable<CacheEntry<T>>
An abstract class to handle cache entries.
Since:
1.0
Version:
8.0
Author:
Luke
  • Field Details

    • _createExpire

      protected long _createExpire
      A Helper variable used to track either creation or expiry time.
  • Constructor Details

    • CacheEntry

      CacheEntry(T entry)
      Initializes the entry.
      Parameters:
      entry - the cached data
    • CacheEntry

      CacheEntry(Object key, T entry)
      Initializes the key and the entry.
      Parameters:
      key - the key
      entry - the entry
  • Method Details

    • getKey

      Object getKey()
      Returns the object's cache key.
      Returns:
      the key
    • get

      public T get()
      Returns the cached object.
      Returns:
      the object
    • toString

      public String toString()
      Returns the string representation of the cache key.
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(CacheEntry<T> e2)
      Specified by:
      compareTo in interface Comparable<T extends Cacheable>