1 package org.apache.jcs.auxiliary;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.IOException;
23 import java.io.Serializable;
24 import java.util.Set;
25
26 import org.apache.jcs.engine.behavior.ICache;
27 import org.apache.jcs.engine.behavior.IElementSerializer;
28 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
29 import org.apache.jcs.engine.stats.behavior.IStats;
30
31 /**
32 * Tag interface for auxiliary caches. Currently this provides no additional methods over what is in
33 * ICache, but I anticipate that will change. For example, there will be a mechanism for determining
34 * the type (disk/lateral/remote) of the auxiliary here -- and the existing getCacheType will be
35 * removed from ICache.
36 */
37 public interface AuxiliaryCache<K extends Serializable, V extends Serializable>
38 extends ICache<K, V>
39 {
40 /**
41 * Gets the set of keys of objects currently in the group
42 * @param group
43 * @return a set of group keys
44 * @throws IOException
45 */
46 Set<K> getGroupKeys( String group )
47 throws IOException;
48
49 /**
50 * Gets the set of group names currently in the cache
51 * @return a set of group names
52 * @throws IOException
53 */
54 Set<String> getGroupNames()
55 throws IOException;
56
57 /**
58 * @return the historical and statistical data for a region's auxiliary cache.
59 */
60 IStats getStatistics();
61
62 /**
63 * This returns the generic attributes for an auxiliary cache. Most implementations will cast
64 * this to a more specific type.
65 * <p>
66 * @return the attributes for the auxiliary cache
67 */
68 AuxiliaryCacheAttributes getAuxiliaryCacheAttributes();
69
70 /**
71 * Allows you to inject a custom serializer. A good example would be a compressing standard
72 * serializer.
73 * <p>
74 * @param elementSerializer
75 */
76 void setElementSerializer( IElementSerializer elementSerializer );
77
78 /**
79 * Every Auxiliary must allow for the use of an event logger.
80 * <p>
81 * @param cacheEventLogger
82 */
83 void setCacheEventLogger( ICacheEventLogger cacheEventLogger );
84 }