Package com.okta.sdk.impl.cache
Class DefaultCache.Entry<V>
java.lang.Object
com.okta.sdk.impl.cache.DefaultCache.Entry<V>
- Type Parameters:
V- the type of value that is stored in the cache.
- Enclosing class:
DefaultCache<K,V>
An Entry is a wrapper that encapsulates the actual
value stored in the cache as well as
creationTimeMillis and lastAccessTimeMillis
metadata about the entry itself. The creationTimeMillis and lastAccessTimeMillis values are used
to support expunging cache entries based on
timeToIdle and
timeToLive settings, respectively.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Entry instance wrapping the specifiedvalue, defaulting both thecreationTimeMillisand thelastAccessTimeMillsto the current timestamp (i.e. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the creation time in millis since Epoch when thisEntryinstance was created.longReturns the time in millis since Epoch when thisEntryinstance was last accessed.getValue()Returns the actual value stored in the cache.
-
Constructor Details
-
Entry
Creates a new Entry instance wrapping the specifiedvalue, defaulting both thecreationTimeMillisand thelastAccessTimeMillsto the current timestamp (i.e.System.currentTimeMillis()).- Parameters:
value- the cache entry to store.
-
-
Method Details
-
getValue
Returns the actual value stored in the cache.- Returns:
- the actual value stored in the cache.
-
getCreationTimeMillis
public long getCreationTimeMillis()Returns the creation time in millis since Epoch when thisEntryinstance was created. This is used to support expunging cache entries when this value is older than the cache'stimeToLivesetting.- Returns:
- the creation time in millis since Epoch when this
Entryinstance was created.
-
getLastAccessTimeMillis
public long getLastAccessTimeMillis()Returns the time in millis since Epoch when thisEntryinstance was last accessed. This is used to support expunging cache entries when this value is older than the cache'stimeToIdlesetting.- Returns:
- the time in millis since Epoch when this
Entryinstance was last accessed.
-