01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.cache;
05:
06: import com.tc.object.ObjectID;
07:
08: import gnu.trove.TLinkable;
09:
10: /**
11: * Interface for objects that can be stored in the cache
12: *
13: * @author steve
14: */
15: public interface Cacheable extends TLinkable {
16:
17: /**
18: * Get object identifier
19: * @return Identifer
20: */
21: public ObjectID getObjectID();
22:
23: /**
24: * Mark object as accessed
25: */
26: public void markAccessed();
27:
28: /**
29: * Clear access count
30: */
31: public void clearAccessed();
32:
33: /**
34: * Determine whether object was accessed since a clear occurred
35: * @return True if accessed since clear
36: */
37: public boolean recentlyAccessed();
38:
39: /**
40: * Reduce access count by factor
41: * @param factor Factor by which accessCount to be reduced.
42: * @return New accessCount after being divided by factor
43: * @throws ArithmeticException if factor=0
44: */
45: public int accessCount(int factor);
46:
47: /**
48: * This method checks to see if the element is in a state where it can be evicted.
49: * @return True if can evict now
50: */
51: public boolean canEvict();
52:
53: }
|