1 package org.apache.jcs.engine.behavior;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.IOException;
23 import java.io.Serializable;
24
25 /***
26 * Used to receive a cache event notification.
27 * <p>
28 * Note: objects which implement this interface are local listeners to cache changes, whereas
29 * objects which implement IRmiCacheListener are remote listeners to cache changes.
30 */
31 public interface ICacheListener
32 {
33 /***
34 * Notifies the subscribers for a cache entry update.
35 * <p>
36 * @param item
37 * @throws IOException
38 */
39 public void handlePut( ICacheElement item )
40 throws IOException;
41
42 /***
43 * Notifies the subscribers for a cache entry removal.
44 * <p>
45 * @param cacheName
46 * @param key
47 * @throws IOException
48 */
49 public void handleRemove( String cacheName, Serializable key )
50 throws IOException;
51
52 /***
53 * Notifies the subscribers for a cache remove-all.
54 * <p>
55 * @param cacheName
56 * @throws IOException
57 */
58 public void handleRemoveAll( String cacheName )
59 throws IOException;
60
61 /***
62 * Notifies the subscribers for freeing up the named cache.
63 * <p>
64 * @param cacheName
65 * @throws IOException
66 */
67 public void handleDispose( String cacheName )
68 throws IOException;
69
70 /***
71 * sets unique identifier of listener home
72 * <p>
73 * @param id The new listenerId value
74 * @throws IOException
75 */
76 public void setListenerId( long id )
77 throws IOException;
78
79 /***
80 * Gets the listenerId attribute of the ICacheListener object
81 * <p>
82 * @return The listenerId value
83 * @throws IOException
84 */
85 public long getListenerId()
86 throws IOException;
87 }