net.spy.cache
Interface Cachable

All Superinterfaces:
CacheListener
All Known Implementing Classes:
AbstractCachable

public interface Cachable
extends CacheListener

Object that are self-maintaining in a cache.


Method Summary
 int getAccessCount()
          Get the number of times this object has been accessed.
 Object getCachedObject()
          Get the value that has been cached.
 Object getCacheKey()
          Get the key with which this object is cached.
 long getCacheTime()
          Get the timestamp at which this object was cached.
 long getLastAccessTime()
          Get the timestamp of the last access.
 boolean isExpired()
          Determine whether this cache entry has expired.
 void setAccessTime(long t)
          Set the timestamp of a particular access.
 
Methods inherited from interface net.spy.cache.CacheListener
cachedEvent, uncachedEvent
 

Method Detail

getCacheKey

public Object getCacheKey()
Get the key with which this object is cached.


getCachedObject

public Object getCachedObject()
Get the value that has been cached.


isExpired

public boolean isExpired()
Determine whether this cache entry has expired.

Returns:
true if the object has expired

getCacheTime

public long getCacheTime()
Get the timestamp at which this object was cached.


getLastAccessTime

public long getLastAccessTime()
Get the timestamp of the last access.


setAccessTime

public void setAccessTime(long t)
Set the timestamp of a particular access. Implementations are expected to increment their access count and determine whether this particular access time is mroe recent than their current latest access time (which may be the case if the notifications are asynchronous).

Parameters:
t - a timestamp indicating access

getAccessCount

public int getAccessCount()
Get the number of times this object has been accessed.