net.spy.cache
Class AbstractCachable

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.cache.AbstractCacheListener
          extended by net.spy.cache.AbstractCachable
All Implemented Interfaces:
Cachable, CacheListener

public abstract class AbstractCachable
extends AbstractCacheListener
implements Cachable

Abstract implementation of Cachable.


Constructor Summary
AbstractCachable(Object k, Object v)
          Get an instance of AbstractCachable.
 
Method Summary
 void cachedEvent(Object k)
          Override cachedEvent to also send the message to the cached object if it wants it.
 int getAccessCount()
          Get the number of times this object has been accessed.
 Object getCachedObject()
          Get the object that was cached.
 Object getCacheKey()
          Get the cache key.
 long getCacheTime()
          Get the time at which this thing was cached.
 long getLastAccessTime()
          Get the timestamp of the last access of this object.
 void setAccessTime(long t)
          Mark a new access.
 void uncachedEvent(Object k)
          Override uncachedEvent to also send the message to the cached object if it wants it.
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.spy.cache.Cachable
isExpired
 

Constructor Detail

AbstractCachable

public AbstractCachable(Object k,
                        Object v)
Get an instance of AbstractCachable.

Method Detail

getCacheTime

public long getCacheTime()
Get the time at which this thing was cached.

Specified by:
getCacheTime in interface Cachable

getCacheKey

public Object getCacheKey()
Get the cache key.

Specified by:
getCacheKey in interface Cachable

getCachedObject

public Object getCachedObject()
Get the object that was cached.

Specified by:
getCachedObject in interface Cachable

getLastAccessTime

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

Specified by:
getLastAccessTime in interface Cachable

setAccessTime

public void setAccessTime(long t)
Mark a new access.

Specified by:
setAccessTime in interface Cachable
Parameters:
t - the time at which the access occurred

getAccessCount

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

Specified by:
getAccessCount in interface Cachable

cachedEvent

public void cachedEvent(Object k)
Override cachedEvent to also send the message to the cached object if it wants it.

Specified by:
cachedEvent in interface CacheListener
Overrides:
cachedEvent in class AbstractCacheListener
Parameters:
k - the key with which the object was cached

uncachedEvent

public void uncachedEvent(Object k)
Override uncachedEvent to also send the message to the cached object if it wants it.

Specified by:
uncachedEvent in interface CacheListener
Overrides:
uncachedEvent in class AbstractCacheListener
Parameters:
k -


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.