KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > eviction > LRUPolicy


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  * Created on March 25 2003
7  */

8 package org.jboss.cache.eviction;
9
10 import org.jboss.cache.CacheImpl;
11 import org.jboss.cache.RegionManager;
12
13 /**
14  * Provider to provide eviction policy. This one is based on LRU algorithm that a user
15  * can specify either maximum number of nodes or the idle time of a node to be evicted.
16  *
17  * @author Ben Wang 02-2004
18  * @author Daniel Huang - dhuang@jboss.org
19  * @version $Revision: 1.12 $
20  */

21 public class LRUPolicy extends BaseEvictionPolicy implements EvictionPolicy
22 {
23    protected RegionManager regionManager_;
24
25    protected EvictionAlgorithm algorithm;
26
27    public LRUPolicy()
28    {
29       super();
30       algorithm = new LRUAlgorithm();
31    }
32
33    public EvictionAlgorithm getEvictionAlgorithm()
34    {
35       return algorithm;
36    }
37
38    public Class JavaDoc getEvictionConfigurationClass()
39    {
40       return LRUConfiguration.class;
41    }
42
43    public void configure(CacheImpl cache)
44    {
45       super.configure(cache);
46       regionManager_ = cache_.getRegionManager();
47    }
48 }
49
Popular Tags