01: package org.shiftone.cache.policy.lfu;
02:
03: import org.shiftone.cache.util.CacheNode;
04: import org.shiftone.cache.util.LinkedListNode;
05:
06: /**
07: * Class LfuNode
08: *
09: *
10: * @author <a href="mailto:jeff@shiftone.org">Jeff Drost</a>
11: * @version $Revision: 1.1 $
12: */
13: class LfuNode implements CacheNode {
14:
15: /// private static final Logger LOG = Logger.getLogger(LfuNode.class);
16: Object key = null;
17: Object value = null;
18: LinkedListNode fifoNode = null;
19: LinkedListNode lfuNode = null;
20: long timeoutTime = 0;
21: int numUsages = 0;
22:
23: public final boolean isExpired() {
24:
25: long timeToGo = timeoutTime - System.currentTimeMillis();
26:
27: return (timeToGo <= 0);
28: }
29:
30: public final Object getValue() {
31: return this .value;
32: }
33:
34: public final void setValue(Object value) {
35: this .value = value;
36: }
37:
38: public String toString() {
39: return "(lfu-" + String.valueOf(key) + ":u=" + numUsages + ")";
40: }
41: }
|