KickJava   Java API By Example, From Geeks To Geeks.

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


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 com.tc.text.PrettyPrinter;
7
8 import java.util.Collection JavaDoc;
9 import java.util.Collections JavaDoc;
10
11 /**
12  * @author steve
13  */

14 public class NullCache implements EvictionPolicy {
15
16   public synchronized boolean add(Cacheable obj) {
17     return false;
18   }
19   
20   public Collection JavaDoc getRemovalCandidates(int maxCount) {
21     return Collections.EMPTY_LIST;
22   }
23
24   public synchronized void remove(Cacheable obj) {
25     //nothing to remove. The cache is null
26
}
27
28   public synchronized void markReferenced(Cacheable obj) {
29     //move the referenced object up in the lru
30
}
31
32   public PrettyPrinter prettyPrint(PrettyPrinter out) {
33     return out.println("NULL CACHE");
34   }
35
36   public int getCacheCapacity() {
37     return Integer.MAX_VALUE;
38   }
39 }
Popular Tags