KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > oscache > base > algorithm > UnlimitedCache


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.oscache.base.algorithm;
6
7
8 /**
9  * A simple unlimited cache that has no upper bound to the number of
10  * cache entries it can contain.
11  *
12  * @version $Revision: 1.1 $
13  * @author <a HREF="mailto:fbeauregard@pyxis-tech.com">Francois Beauregard</a>
14  * @author <a HREF="mailto:abergevin@pyxis-tech.com">Alain Bergevin</a>
15  */

16 public final class UnlimitedCache extends AbstractConcurrentReadCache {
17     /**
18      * Creates an unlimited cache by calling the super class's constructor
19      * with an <code>UNLIMITED</code> maximum number of entries.
20      */

21     public UnlimitedCache() {
22         super();
23         maxEntries = UNLIMITED;
24     }
25
26     /**
27      * Overrides the <code>setMaxEntries</code> with an empty implementation.
28      * This property cannot be modified and is ignored for an
29      * <code>UnlimitedCache</code>.
30      */

31     public void setMaxEntries(int maxEntries) {
32     }
33
34     /**
35      * Implements <code>itemRetrieved</code> with an empty implementation.
36      * The unlimited cache doesn't care that an item was retrieved.
37      */

38     protected void itemRetrieved(Object JavaDoc key) {
39     }
40
41     /**
42      * Implements <code>itemPut</code> with an empty implementation.
43      * The unlimited cache doesn't care that an item was put in the cache.
44      */

45     protected void itemPut(Object JavaDoc key) {
46     }
47
48     /**
49      * This method just returns <code>null</code> since items should
50      * never end up being removed from an unlimited cache!
51      */

52     protected Object JavaDoc removeItem() {
53         return null;
54     }
55
56     /**
57      * An empty implementation. The unlimited cache doesn't care that an
58      * item was removed.
59      */

60     protected void itemRemoved(Object JavaDoc key) {
61     }
62 }
63
Popular Tags