Class PspDatedCacheElement<V>
java.lang.Object
edu.internet2.middleware.grouper.pspng.PspDatedCacheElement<V>
- Type Parameters:
V
-
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Only compares CacheElements based on the value and not the date they were cached.getValue()
getValueIfNewEnough
(long oldestAllowedAge_ms) Get the value if it is new enough.getValueIfNewEnough
(org.joda.time.DateTime oldestAllowedAge) Get the value if it is new enoughint
hashCode()
boolean
isNewEnough
(long oldestAllowedAge_ms) boolean
isNewEnough
(org.joda.time.DateTime oldestAllowedAge) boolean
isOlderThan
(long time_ms) boolean
isOlderThan
(org.joda.time.DateTime aDate)
-
Field Details
-
storedTime_ms
protected long storedTime_ms -
value
-
-
Constructor Details
-
PspDatedCacheElement
-
-
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
-
getValueIfNewEnough
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
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
Only compares CacheElements based on the value and not the date they were cached. -
hashCode
public int hashCode()
-