jodd.cache
Class TimedCache<K,V>

java.lang.Object
  extended by jodd.cache.AbstractCacheMap<K,V>
      extended by jodd.cache.TimedCache<K,V>
All Implemented Interfaces:
Cache<K,V>

public class TimedCache<K,V>
extends AbstractCacheMap<K,V>

Timed cache. Not limited by size, objects are removed only when they are expired. Prune is not invoked explicitly by standard Cache methods, however, it is possible to schedule prunes on fined-rate delays.


Field Summary
protected  java.util.Timer pruneTimer
           
 
Fields inherited from class jodd.cache.AbstractCacheMap
cacheLock, cacheMap, cacheSize, existCustomTimeout, timeout
 
Constructor Summary
TimedCache(long timeout)
           
 
Method Summary
 void cancelPruneSchedule()
          Cancels prune schedules.
protected  int pruneCache()
          Prunes expired elements from the cache.
 void schedulePrune(long delay)
          Schedules prune.
 
Methods inherited from class jodd.cache.AbstractCacheMap
clear, get, getCacheSize, getCacheTimeout, isEmpty, isFull, isPruneExpiredActive, iterator, prune, put, put, remove, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pruneTimer

protected java.util.Timer pruneTimer
Constructor Detail

TimedCache

public TimedCache(long timeout)
Method Detail

pruneCache

protected int pruneCache()
Prunes expired elements from the cache. Returns the number of removed objects.

Specified by:
pruneCache in class AbstractCacheMap<K,V>

schedulePrune

public void schedulePrune(long delay)
Schedules prune.


cancelPruneSchedule

public void cancelPruneSchedule()
Cancels prune schedules.



Copyright © 2003-2012 Jodd Team