1 package org.apache.turbine.services.cache;
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
24 import org.apache.turbine.services.Service;
25
26 /***
27 * GlobalCacheService interface.
28 *
29 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
30 * @version $Id: GlobalCacheService.java 534527 2007-05-02 16:10:59Z tv $
31 */
32 public interface GlobalCacheService
33 extends Service
34 {
35 String SERVICE_NAME = "GlobalCacheService";
36
37 /***
38 * Gets a cached object given its id (a String).
39 *
40 * @param id The String id for the object.
41 * @return A CachedObject.
42 * @exception ObjectExpiredException, if the object has expired in
43 * the cache.
44 */
45 CachedObject getObject(String id)
46 throws ObjectExpiredException;
47
48 /***
49 * Adds an object to the cache.
50 *
51 * @param id The String id for the object.
52 * @param o The object to add to the cache.
53 */
54 void addObject(String id, CachedObject o);
55
56 /***
57 * Removes an object from the cache.
58 *
59 * @param id The String id for the object.
60 */
61 void removeObject(String id);
62
63 /***
64 * Returns the current size of the cache.
65 * @return int representing current cache size in number of bytes
66 */
67 int getCacheSize()
68 throws IOException;
69
70 /***
71 * Returns the number of objects in the cache.
72 * @return int The current number of objects in the cache.
73 */
74 int getNumberOfObjects();
75
76 /***
77 * Flush the cache of all objects.
78 */
79 void flushCache();
80 }