| 1 | package org.apache.commons.jcs3.access.behavior; |
| 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.util.Set; |
| 23 | |
| 24 | import org.apache.commons.jcs3.access.exception.CacheException; |
| 25 | import org.apache.commons.jcs3.engine.behavior.IElementAttributes; |
| 26 | |
| 27 | /** |
| 28 | * IGroupCacheAccess defines group specific behavior for the client access |
| 29 | * classes. |
| 30 | */ |
| 31 | public interface IGroupCacheAccess<K, V> |
| 32 | extends ICacheAccessManagement |
| 33 | { |
| 34 | /** |
| 35 | * Gets the g attribute of the IGroupCacheAccess object |
| 36 | * <p> |
| 37 | * @param name |
| 38 | * @param group |
| 39 | * the name of the group to associate this with. |
| 40 | * @return The object that is keyed by the name in the group |
| 41 | */ |
| 42 | V getFromGroup( K name, String group ); |
| 43 | |
| 44 | /** |
| 45 | * Puts an item in the cache associated with this group. |
| 46 | * <p> |
| 47 | * @param key |
| 48 | * @param group |
| 49 | * @param obj |
| 50 | * @throws CacheException |
| 51 | */ |
| 52 | void putInGroup( K key, String group, V obj ) |
| 53 | throws CacheException; |
| 54 | |
| 55 | /** |
| 56 | * Put in the cache associated with this group using these attributes. |
| 57 | * <p> |
| 58 | * @param key |
| 59 | * @param group |
| 60 | * @param obj |
| 61 | * @param attr |
| 62 | * @throws CacheException |
| 63 | */ |
| 64 | void putInGroup( K key, String group, V obj, IElementAttributes attr ) |
| 65 | throws CacheException; |
| 66 | |
| 67 | /** |
| 68 | * Remove the item from this group in this region by this name. |
| 69 | * <p> |
| 70 | * @param name |
| 71 | * @param group |
| 72 | */ |
| 73 | void removeFromGroup( K name, String group ); |
| 74 | |
| 75 | /** |
| 76 | * Gets the set of keys of objects currently in the group |
| 77 | * <p> |
| 78 | * @param group |
| 79 | * @return the set of group keys. |
| 80 | */ |
| 81 | Set<K> getGroupKeys( String group ); |
| 82 | |
| 83 | /** |
| 84 | * Invalidates a group |
| 85 | * <p> |
| 86 | * @param group |
| 87 | */ |
| 88 | void invalidateGroup( String group ); |
| 89 | } |