KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > suberic > util > cache > SizedCache


1 package net.suberic.util.cache;
2
3 /**
4  * This represents a cache that will cache objects up to a certain amount
5  * of space. After that space is filled, it will start removing items
6  * using a least recently used algorithm.
7  */

8 public interface SizedCache {
9   
10   /**
11    * Adds an object to the Cache.
12    */

13   public void add(Object JavaDoc key, Object JavaDoc value);
14
15   /**
16    * Gets an object from the Cache. If the object is not available,
17    * returns null.
18    */

19   public Object JavaDoc get(Object JavaDoc key);
20
21   /**
22    * Removes an object from the Cache.
23    */

24   public void invalidateCache(Object JavaDoc key);
25
26   /**
27    * Invalidates the entire cache.
28    */

29   public void invalidateCache();
30
31   /**
32    * Gets the size limit for the cache.
33    */

34   public long getMaxSize();
35
36   /**
37    * Gets the size limit for an individual item in the cache. For obvious
38    * reasons, this should probably not be greater than the max size.
39    */

40   public long getMaxEntrySize();
41
42   /**
43    * Gets the current size of the cache.
44    */

45   public long getSize();
46
47 }
48
Popular Tags