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 import org.apache.jcs.access.exception.ObjectExistsException;
26 import org.apache.jcs.access.exception.ObjectNotFoundException;
27
28 /***
29 * Used to retrieve and update the cache. <br>
30 * <br>
31 * Note: server which implements this interface provides a local cache service, whereas server which
32 * implements IRmiCacheService provides a remote cache service.
33 */
34 public interface ICacheService
35 {
36 /***
37 * Puts a cache item to the cache.
38 * <p>
39 * @param item
40 * @throws ObjectExistsException
41 * @throws IOException
42 */
43 public void update( ICacheElement item )
44 throws ObjectExistsException, IOException;
45
46 /***
47 * Returns a cache bean from the specified cache; or null if the key does not exist.
48 * <p>
49 * @param cacheName
50 * @param key
51 * @return
52 * @throws ObjectNotFoundException
53 * @throws IOException
54 */
55 public ICacheElement get( String cacheName, Serializable key )
56 throws ObjectNotFoundException, IOException;
57
58 /***
59 * Removes the given key from the specified cache.
60 * <p>
61 * @param cacheName
62 * @param key
63 * @throws IOException
64 */
65 public void remove( String cacheName, Serializable key )
66 throws IOException;
67
68 /***
69 * Remove all keys from the sepcified cache.
70 * @param cacheName
71 * @throws IOException
72 */
73 public void removeAll( String cacheName )
74 throws IOException;
75
76 /***
77 * Frees the specified cache.
78 * <p>
79 * @param cacheName
80 * @throws IOException
81 */
82 public void dispose( String cacheName )
83 throws IOException;
84
85 /***
86 * Frees all caches.
87 * @throws IOException
88 */
89 public void release()
90 throws IOException;
91 }