org.ehcache.spi.cache
Interface Store.ValueHolder<V>

Type Parameters:
V -
All Known Implementing Classes:
AbstractValueHolder, OffHeapValueHolder
Enclosing interface:
Store<K,V>

public static interface Store.ValueHolder<V>

Holds both a value, and all the metadata associated with a mapping in a Store.


Field Summary
static long NO_EXPIRE
           
 
Method Summary
 long creationTime(java.util.concurrent.TimeUnit unit)
          Accessor to the creation time of this ValueHolder
 long expirationTime(java.util.concurrent.TimeUnit unit)
          Accessor to the expiration time of this ValueHolder
 long getId()
          The combination of this identifier and the key that ValueHolder is mapped to should to be unique at a given time.
 float hitRate(long now, java.util.concurrent.TimeUnit unit)
          Accessor to the hit rate of the Value held in this ValueHolder?
 long hits()
           
 boolean isExpired(long expirationTime, java.util.concurrent.TimeUnit unit)
          Check if the ValueHolder is expired relative to the specified time
 long lastAccessTime(java.util.concurrent.TimeUnit unit)
          Accessor to the last access time of the Value held in this ValueHolder
 V value()
          Accessor to the value held by this mapping.
 

Field Detail

NO_EXPIRE

static final long NO_EXPIRE
See Also:
Constant Field Values
Method Detail

value

V value()
Accessor to the value held by this mapping.

Returns:
The value
Throws:
java.lang.Exception - when something goes wrong... e.g. deserialization?

creationTime

long creationTime(java.util.concurrent.TimeUnit unit)
Accessor to the creation time of this ValueHolder

Parameters:
unit - the timeUnit to return the creation time in
Returns:
the creation time in the given unit

expirationTime

long expirationTime(java.util.concurrent.TimeUnit unit)
Accessor to the expiration time of this ValueHolder

Parameters:
unit - the timeUnit to return the creation time in
Returns:
the expiration time in the given unit. A value of NO_EXPIRE means that the ValueHolder will never expire.

isExpired

boolean isExpired(long expirationTime,
                  java.util.concurrent.TimeUnit unit)
Check if the ValueHolder is expired relative to the specified time

Parameters:
expirationTime - the expiration time relative to which the expiry check must be made
unit - the unit of the expiration time
Returns:
true if the ValueHolder expired relative to the given expiration time

lastAccessTime

long lastAccessTime(java.util.concurrent.TimeUnit unit)
Accessor to the last access time of the Value held in this ValueHolder

Parameters:
unit - the timeUnit to return the last access time in
Returns:
the last access time in the given unit

hitRate

float hitRate(long now,
              java.util.concurrent.TimeUnit unit)
Accessor to the hit rate of the Value held in this ValueHolder?

Parameters:
now - the time in TimeUnit.MILLISECONDS upto which the rate needs to be calculated
unit - the TimeUnit in which the rate is to returned
Returns:
the hit rate in the given unit

hits

long hits()
Returns:
hit counter of the Value held in this ValueHolder

getId

long getId()
The combination of this identifier and the key that ValueHolder is mapped to should to be unique at a given time.

Returns:
a unique identifier