|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
UnlimitedCache.java | - | 100% | 100% | 100% |
|
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 | 35 |
public UnlimitedCache() {
|
22 | 35 |
super();
|
23 | 35 |
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 | 6 |
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 | 152 |
protected void itemRetrieved(Object 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 | 145 |
protected void itemPut(Object 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 | 6 |
protected Object removeItem() {
|
53 | 6 |
return null; |
54 |
} |
|
55 |
|
|
56 |
/**
|
|
57 |
* An empty implementation. The unlimited cache doesn't care that an
|
|
58 |
* item was removed.
|
|
59 |
*/
|
|
60 | 39 |
protected void itemRemoved(Object key) { |
61 |
} |
|
62 |
} |
|
63 |
|
|