01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.caching;
18:
19: import java.io.Serializable;
20:
21: import org.apache.avalon.framework.component.Component;
22: import org.apache.cocoon.ProcessingException;
23:
24: /**
25: * This is the Cocoon cache. This component is responsible for storing
26: * and retrieving cached responses. It can be used to monitor the cache
27: * or to investigate which responses are cached etc.
28: * This interface will grow!
29: *
30: * @since 2.1
31: * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
32: * @version CVS $Id: Cache.java 433543 2006-08-22 06:22:54Z crossley $
33: */
34: public interface Cache extends Component {
35:
36: /** The Avalon Role **/
37: String 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 key, CachedResponse response)
46: throws ProcessingException;
47:
48: /**
49: * Get a cached response.
50: * If it is not available <code>null</code> is returned.
51: * @param key the key used by the caching algorithm to identify the
52: * request
53: */
54: CachedResponse get(Serializable key);
55:
56: /**
57: * Remove a cached response.
58: * If it is not available no operation is performed.
59: * @param key the key used by the caching algorithm to identify the
60: * request
61: */
62: void remove(Serializable key);
63:
64: /**
65: * clear cache of all cached responses
66: */
67: void clear();
68:
69: /**
70: * See if a response is cached under this key.
71: */
72: boolean containsKey(Serializable key);
73: }
|