01: package net.suberic.util.cache;
02:
03: /**
04: * This represents a cache that will cache objects up to a certain amount
05: * of space. After that space is filled, it will start removing items
06: * using a least recently used algorithm.
07: */
08: public interface SizedCache {
09:
10: /**
11: * Adds an object to the Cache.
12: */
13: public void add(Object key, Object value);
14:
15: /**
16: * Gets an object from the Cache. If the object is not available,
17: * returns null.
18: */
19: public Object get(Object key);
20:
21: /**
22: * Removes an object from the Cache.
23: */
24: public void invalidateCache(Object 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: }
|