KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > cache > EvictionPolicy


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.cache;
5
6 import java.util.Collection JavaDoc;
7
8 import com.tc.text.PrettyPrintable;
9
10
11 /**
12  * @author steve
13  */

14 public interface EvictionPolicy extends PrettyPrintable {
15   /**
16    * Add an object to the cache and return true if objects has to be be evicted from the cache.
17    *
18    * @param obj - object that should be cached.
19    * @return true if objects should be removed from the cache
20    */

21   public boolean add(Cacheable obj);
22   
23   /**
24    * returns a list of objects can be evicted from the cache.
25    * Note: It doesn't actually evict them, it is advisory at this point
26    *
27    * @param maxCount - the maxCount of objects that should be returned.
28    * @return Collection of objects that can be removed from the cache
29    */

30   public Collection JavaDoc getRemovalCandidates(int maxCount);
31
32   /**
33    * Retrieve a cached object from the cache.
34    *
35    * @param ObjectID of the object to be retrieved
36    * @return Cacheable - the requested object
37    */

38   public void remove(Cacheable obj);
39
40   /**
41    * moves it up the lru chain
42    */

43   public void markReferenced(Cacheable obj);
44   
45   /**
46    * @return the cache Capacity when the cache becomes full
47    */

48   public int getCacheCapacity();
49
50 }
Popular Tags