| 1 | package org.apache.commons.jcs3.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.util.Set; |
| 24 | |
| 25 | import org.apache.commons.jcs3.engine.behavior.ICache; |
| 26 | import org.apache.commons.jcs3.engine.behavior.IElementSerializer; |
| 27 | import org.apache.commons.jcs3.engine.logging.behavior.ICacheEventLogger; |
| 28 | import org.apache.commons.jcs3.engine.stats.behavior.IStats; |
| 29 | |
| 30 | /** |
| 31 | * Tag interface for auxiliary caches. Currently this provides no additional methods over what is in |
| 32 | * ICache, but I anticipate that will change. For example, there will be a mechanism for determining |
| 33 | * the type (disk/lateral/remote) of the auxiliary here -- and the existing getCacheType will be |
| 34 | * removed from ICache. |
| 35 | */ |
| 36 | public interface AuxiliaryCache<K, V> |
| 37 | extends ICache<K, V> |
| 38 | { |
| 39 | /** |
| 40 | * Get a set of the keys for all elements in the auxiliary cache. |
| 41 | * <p> |
| 42 | * @return a set of the key type |
| 43 | * TODO This should probably be done in chunks with a range passed in. This |
| 44 | * will be a problem if someone puts a 1,000,000 or so items in a |
| 45 | * region. |
| 46 | * @throws IOException if access to the auxiliary cache fails |
| 47 | */ |
| 48 | Set<K> getKeySet() throws IOException; |
| 49 | |
| 50 | /** |
| 51 | * @return the historical and statistical data for a region's auxiliary cache. |
| 52 | */ |
| 53 | IStats getStatistics(); |
| 54 | |
| 55 | /** |
| 56 | * This returns the generic attributes for an auxiliary cache. Most implementations will cast |
| 57 | * this to a more specific type. |
| 58 | * <p> |
| 59 | * @return the attributes for the auxiliary cache |
| 60 | */ |
| 61 | AuxiliaryCacheAttributes getAuxiliaryCacheAttributes(); |
| 62 | |
| 63 | /** |
| 64 | * Allows you to inject a custom serializer. A good example would be a compressing standard |
| 65 | * serializer. |
| 66 | * <p> |
| 67 | * @param elementSerializer |
| 68 | */ |
| 69 | void setElementSerializer( IElementSerializer elementSerializer ); |
| 70 | |
| 71 | /** |
| 72 | * Every Auxiliary must allow for the use of an event logger. |
| 73 | * <p> |
| 74 | * @param cacheEventLogger |
| 75 | */ |
| 76 | void setCacheEventLogger( ICacheEventLogger cacheEventLogger ); |
| 77 | } |