Class PspDatedCacheElement<V>

java.lang.Object
edu.internet2.middleware.grouper.pspng.PspDatedCacheElement<V>
Type Parameters:
V -

public class PspDatedCacheElement<V> extends Object
This is a wrapper that stores a value along with the date it was cached. Theoretically, this is not needed if GrouperCache provided access to its Element cached items, but it seems easiest to create a thin wrapper so that GrouperCache's API is not made more complicated. This is used by the PspDatedCache so that cached values can be used only when they're "new enough" to satisfy the current request.
  • Field Details

    • storedTime_ms

      protected long storedTime_ms
    • value

      protected V value
  • Constructor Details

    • PspDatedCacheElement

      public PspDatedCacheElement(V value)
  • Method Details

    • isNewEnough

      public boolean isNewEnough(org.joda.time.DateTime oldestAllowedAge)
    • isNewEnough

      public boolean isNewEnough(long oldestAllowedAge_ms)
    • isOlderThan

      public boolean isOlderThan(org.joda.time.DateTime aDate)
    • isOlderThan

      public boolean isOlderThan(long time_ms)
    • getValue

      public V getValue()
    • getValueIfNewEnough

      public V getValueIfNewEnough(org.joda.time.DateTime oldestAllowedAge)
      Get the value if it is new enough
      Parameters:
      oldestAllowedAge - the date you require the object to be fresher than. Null means to bypass age checks and always return the object.
      Returns:
      the saved value, or null if the saved value was too old
    • getValueIfNewEnough

      public V getValueIfNewEnough(long oldestAllowedAge_ms)
      Get the value if it is new enough. otherwise null is returned
      Parameters:
      oldestAllowedAge_ms - the java epoch that you wish the object to be fresher than. <=0 means to bypass age checks and always return the object.
      Returns:
      the saved value, or null if the saved value was too old
    • equals

      public boolean equals(Object o)
      Only compares CacheElements based on the value and not the date they were cached.
      Overrides:
      equals in class Object
      Parameters:
      o -
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object