01: package javax.cache;
02:
03: /**
04: * Interface describing various events that can happen as elements are added to
05: * or removed from a cache.
06: */
07: public interface CacheListener<K, V> {
08: /**
09: * Triggered when a cache mapping is created due to the cache loader being consulted.
10: *
11: * @param cache
12: * @param key
13: */
14: public void onLoad(K key);
15:
16: /**
17: * Triggered when a cache mapping is created due to calling {@link Cache#put(Object,Object)}}.
18: *
19: * @param cache
20: * @param key
21: */
22: public void onPut(K key);
23:
24: /**
25: * Triggered when a cache mapping is removed due to eviction or expiration.
26: *
27: * @param cache
28: * @param key
29: */
30: public void onEvict(K key);
31:
32: /**
33: * Triggered when a cache mapping is removed due to calling {@link Cache#remove(Object)}.
34: *
35: * @param cache
36: * @param key
37: */
38: public void onRemove(K key);
39:
40: public void onClear();
41:
42: public void onUpdate(K key);
43:
44: public void onExpiry(K key);
45:
46: public void onShutdown();
47:
48: public void onLoadException(K key, Exception e);
49: }
|