01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.cache;
05:
06: import java.util.Collection;
07:
08: import com.tc.text.PrettyPrintable;
09:
10: /**
11: * @author steve
12: */
13: public interface EvictionPolicy extends PrettyPrintable {
14: /**
15: * Add an object to the cache and return true if objects has to be be evicted from the cache.
16: *
17: * @param obj - object that should be cached.
18: * @return true if objects should be removed from the cache
19: */
20: public boolean add(Cacheable obj);
21:
22: /**
23: * returns a list of objects can be evicted from the cache.
24: * Note: It doesn't actually evict them, it is advisory at this point
25: *
26: * @param maxCount - the maxCount of objects that should be returned.
27: * @return Collection of objects that can be removed from the cache
28: */
29: public Collection getRemovalCandidates(int maxCount);
30:
31: /**
32: * Retrieve a cached object from the cache.
33: *
34: * @param ObjectID of the object to be retrieved
35: * @return Cacheable - the requested object
36: */
37: public void remove(Cacheable obj);
38:
39: /**
40: * moves it up the lru chain
41: */
42: public void markReferenced(Cacheable obj);
43:
44: /**
45: * @return the cache Capacity when the cache becomes full
46: */
47: public int getCacheCapacity();
48:
49: }
|