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 * This is the top level interface for all cache like structures. It defines the methods used
27 * internally by JCS to access, modify, and instrument such structures.
28 * <p>
29 * This allows for a suite of reusable components for accessing such structures, for example
30 * asynchronous access via an event queue.
31 */
32 public interface ICache
33 extends ICacheType
34 {
35 /***
36 * Puts an item to the cache.
37 * <p>
38 * @param ce
39 * @throws IOException
40 */
41 public void update( ICacheElement ce )
42 throws IOException;
43
44 /***
45 * Gets an item from the cache.
46 * <p>
47 * @param key
48 * @return
49 * @throws IOException
50 */
51 public ICacheElement get( Serializable key )
52 throws IOException;
53
54 /***
55 * Removes an item from the cache.
56 * <p>
57 * @param key
58 * @return
59 * @throws IOException
60 */
61 public boolean remove( Serializable key )
62 throws IOException;
63
64 /***
65 * Removes all cached items from the cache.
66 * <p>
67 * @throws IOException
68 */
69 public void removeAll()
70 throws IOException;
71
72 /***
73 * Prepares for shutdown.
74 * @throws IOException
75 */
76 public void dispose()
77 throws IOException;
78
79 /***
80 * Returns the current cache size in number of elements.
81 * <p>
82 * @return number of elements
83 */
84 public int getSize();
85
86 /***
87 * Returns the cache status.
88 * <p>
89 * @return Alive or Error
90 */
91 public int getStatus();
92
93 /***
94 * Returns the cache stats.
95 * <p>
96 * @return String of important historical information.
97 */
98 public String getStats();
99
100 /***
101 * Returns the cache name.
102 * <p>
103 * @return usually the region name.
104 */
105 public String getCacheName();
106 }