| |
|
| java.lang.Object com.jcorporate.expresso.core.cache.CacheEntry
CacheEntry | final public class CacheEntry (Code) | | Wrapper for any Cacheable object to be stored in a cache.
This wrapper provides some utility services
to the cacheable object, like maintaining it's usage count
(for the least-frequently-used algorithm
used to free up cache space when needed) and the expiry time
of the object (for caches that use
timed expiry of objects - e.g. keep it cached for x seconds)
|
Field Summary | |
protected long | created |
Constructor Summary | |
public | CacheEntry(Cacheable newContents) | public | CacheEntry(Cacheable newContents, long newExpires) Constructor 2
Parameters: newContents - the object to cache Parameters: newExpires - how long before the object expires. |
created | protected long created(Code) | | When created *
|
CacheEntry | public CacheEntry(Cacheable newContents)(Code) | | Constructor 1
Sets the object to expire in the default time
Parameters: newContents - the Cacheable object you want to cache |
CacheEntry | public CacheEntry(Cacheable newContents, long newExpires)(Code) | | Constructor 2
Parameters: newContents - the object to cache Parameters: newExpires - how long before the object expires. In millis,e.g. 1000 = 1 second |
clearUsedCount | public void clearUsedCount()(Code) | | |
getCreated | public long getCreated()(Code) | | when the object was created |
getExpires | public long getExpires()(Code) | | when the object expires |
getUsedCount | public long getUsedCount()(Code) | | Used for figuring out how often this has been used
The number of times this entry has been used |
incrementUsedCount | public void incrementUsedCount()(Code) | | |
isExpired | final public boolean isExpired()(Code) | | Checks if the object has expired. If it has then it is to be
purged from the cache.
true if the object has expired |
setExpiration | public void setExpiration(long expiration)(Code) | | Set the expiration time for the cache entry.
Parameters: expiration - time in milliseconds to hold the object before it expires. |
|
|
|