|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttuwien.auto.calimero.buffer.cache.CacheObject
public class CacheObject
Holds a key and a value entry and is used by a Cache
.
The key object is not allowed to change after creation of a cache object.
An access count is maintained to tell the number of requests for this
CacheObject by a cache.
The usage value might be used by a caching policy to store a different way of
access counting.
A timestamp is stored of the most recent assignment of a value object hold by
this CacheObject. This timestamp is created with
System.currentTimeMillis()
.
Cache
,
System.currentTimeMillis()
Field Summary | |
---|---|
protected java.lang.Object |
value
The value object hold by this cache object. |
Constructor Summary | |
---|---|
CacheObject(java.lang.Object key,
java.lang.Object value)
Creates a CacheObject associated with key holding a
value entry. |
Method Summary | |
---|---|
int |
getCount()
Returns the access count this cache object was queried from the cache. |
java.lang.Object |
getKey()
Returns the key associated with this cache object. |
long |
getTimestamp()
Returns the most up to date timestamp of the moment the current value object was assigned to this cache object, or the moment this object was Cache.put(CacheObject) into a cache. |
int |
getUsage()
Returns the usage value of this cache object as defined by a particular cache. |
java.lang.Object |
getValue()
Gets the value entry hold by this cache object. |
void |
incCount()
Increments the access count by 1. |
protected void |
resetCount()
Sets the access count to 0. |
void |
resetTimestamp()
Sets the timestamp to time = now. |
protected void |
setUsage(int newUsage)
Sets a new usage value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object value
Constructor Detail |
---|
public CacheObject(java.lang.Object key, java.lang.Object value)
key
holding a
value
entry.
key
- key of this CacheObject
value
- value of this CacheObject
Method Detail |
---|
public final int getCount()
public java.lang.Object getKey()
public final long getTimestamp()
Cache.put(CacheObject)
into a cache.
System.currentTimeMillis()
public final int getUsage()
public java.lang.Object getValue()
Note that the value is guaranteed to be always a non null
reference.
public final void incCount()
It is invoked by a Cache
implementation to record a client access to
this object.
protected final void resetCount()
public final void resetTimestamp()
The timestamp is obtained by System.currentTimeMillis()
.
protected final void setUsage(int newUsage)
The usage value might be used by a caching policy to store a different
way of access counting.
newUsage
- new usage value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |