KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > caching > Cache


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.caching;
17
18 import java.io.Serializable JavaDoc;
19
20 import org.apache.avalon.framework.component.Component;
21 import org.apache.cocoon.ProcessingException;
22
23 /**
24  * This is the Cocoon cache. This component is responsible for storing
25  * and retrieving cached responses. It can be used to monitor the cache
26  * or to investigate which responses are cached etc.
27  * This interface will grow!
28  *
29  * @since 2.1
30  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
31  * @version CVS $Id: Cache.java 30932 2004-07-29 17:35:38Z vgritsenko $
32  */

33 public interface Cache
34 extends Component {
35
36     /** The Avalon Role **/
37     String JavaDoc ROLE = Cache.class.getName();
38
39     /**
40      * Store a cached response
41      * @param key the key used by the caching algorithm to identify the
42      * request
43      * @param response the cached response
44      */

45     void store(Serializable JavaDoc key,
46                CachedResponse response)
47     throws ProcessingException;
48
49     /**
50      * Get a cached response.
51      * If it is not available <code>null</code> is returned.
52      * @param key the key used by the caching algorithm to identify the
53      * request
54      */

55     CachedResponse get(Serializable JavaDoc key);
56
57     /**
58      * Remove a cached response.
59      * If it is not available no operation is performed.
60      * @param key the key used by the caching algorithm to identify the
61      * request
62      */

63     void remove(Serializable JavaDoc key);
64     
65     /**
66      * clear cache of all cached responses
67      */

68     void clear();
69
70     /**
71      * See if a response is cached under this key.
72      */

73     boolean containsKey(Serializable JavaDoc key);
74 }
75
Popular Tags