Class CountLimited

java.lang.Object
org.castor.cache.AbstractBaseCache
org.castor.cache.simple.CountLimited
All Implemented Interfaces:
Map<Object,Object>, Cache

public final class CountLimited extends AbstractBaseCache
CountLimited is a count limted least-recently-used Map. Every object being put in the Map will live until the map is full. If the map is full, the least recently used object will be disposed.

The capacity is passed to the cache at initialization by the individual cache property capacity which defines the maximum number of objects the cache can hold. If not specified a default capacity of 30 objects will be used.

Version:
$Revision: 8102 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Author:
Thomas Yip, Werner Guttmann, Ralf Joachim
  • Field Details

  • Constructor Details

    • CountLimited

      public CountLimited()
  • Method Details

    • initialize

      public void initialize(Properties params) throws CacheAcquireException
      Lyfe-cycle method to allow custom initialization of cache implementations.
      Specified by:
      initialize in interface Cache
      Overrides:
      initialize in class AbstractBaseCache
      Parameters:
      params - Parameters to initialize the cache (e.g. name, capacity).
      Throws:
      CacheAcquireException - If cache can not be initialized.
    • getType

      public String getType()
      Indicates the type of this cache.
      Returns:
      The cache type.
    • getCapacity

      public int getCapacity()
      Get real capacity of this cache.
      Returns:
      Real capacity of this cache.
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • containsKey

      public boolean containsKey(Object key)
    • containsValue

      public boolean containsValue(Object value)
    • get

      public Object get(Object key)
    • put

      public Object put(Object key, Object value)
    • remove

      public Object remove(Object key)
    • putAll

      public void putAll(Map<? extends Object,? extends Object> map)
    • clear

      public void clear()
    • keySet

      public Set<Object> keySet()
    • values

      public Collection<Object> values()
    • entrySet

      public Set<Map.Entry<Object,Object>> entrySet()