public abstract class AbstractValueHolder<V> extends java.lang.Object implements Store.ValueHolder<V>
NO_EXPIRE
Modifier | Constructor and Description |
---|---|
protected |
AbstractValueHolder(long id,
long creationTime) |
protected |
AbstractValueHolder(long id,
long creationTime,
long expirationTime) |
Modifier and Type | Method and Description |
---|---|
void |
accessed(long now,
java.time.Duration expiration) |
long |
creationTime()
Accessor to the creation time of this ValueHolder
|
boolean |
equals(java.lang.Object obj) |
long |
expirationTime()
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. |
int |
hashCode() |
boolean |
isExpired(long expirationTime)
Check if the ValueHolder is expired relative to the specified time
|
long |
lastAccessTime()
Accessor to the last access time of the Value held in this ValueHolder
|
void |
setExpirationTime(long expirationTime)
Set the new expiration time in milliseconds.
|
void |
setLastAccessTime(long lastAccessTime)
Set the last time this entry was accessed in milliseconds.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
get
protected AbstractValueHolder(long id, long creationTime)
protected AbstractValueHolder(long id, long creationTime, long expirationTime)
public long creationTime()
Store.ValueHolder
creationTime
in interface Store.ValueHolder<V>
public void setExpirationTime(long expirationTime)
Store.ValueHolder.NO_EXPIRE
if the entry
shouldn't expire.expirationTime
- new expiration timepublic void accessed(long now, java.time.Duration expiration)
public long expirationTime()
Store.ValueHolder
expirationTime
in interface Store.ValueHolder<V>
Store.ValueHolder.NO_EXPIRE
means that the ValueHolder will never expire.public boolean isExpired(long expirationTime)
Store.ValueHolder
isExpired
in interface Store.ValueHolder<V>
expirationTime
- the expiration time (in ms) relative to which the expiry check must be madepublic long lastAccessTime()
Store.ValueHolder
lastAccessTime
in interface Store.ValueHolder<V>
public void setLastAccessTime(long lastAccessTime)
lastAccessTime
- last time the entry was accessedpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public long getId()
Store.ValueHolder
key
that ValueHolder is mapped to should to be
unique at a given time.getId
in interface Store.ValueHolder<V>
public java.lang.String toString()
toString
in class java.lang.Object