001package org.apache.commons.jcs3.access.behavior;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.Set;
023
024import org.apache.commons.jcs3.access.exception.CacheException;
025import org.apache.commons.jcs3.engine.behavior.IElementAttributes;
026
027/**
028 * IGroupCacheAccess defines group specific behavior for the client access
029 * classes.
030 */
031public interface IGroupCacheAccess<K, V>
032    extends ICacheAccessManagement
033{
034    /**
035     * Gets the g attribute of the IGroupCacheAccess object
036     * <p>
037     * @param name
038     * @param group
039     *            the name of the group to associate this with.
040     * @return The object that is keyed by the name in the group
041     */
042    V getFromGroup( K name, String group );
043
044    /**
045     * Puts an item in the cache associated with this group.
046     * <p>
047     * @param key
048     * @param group
049     * @param obj
050     * @throws CacheException
051     */
052    void putInGroup( K key, String group, V obj )
053        throws CacheException;
054
055    /**
056     * Put in the cache associated with this group using these attributes.
057     * <p>
058     * @param key
059     * @param group
060     * @param obj
061     * @param attr
062     * @throws CacheException
063     */
064    void putInGroup( K key, String group, V obj, IElementAttributes attr )
065        throws CacheException;
066
067    /**
068     * Remove the item from this group in this region by this name.
069     * <p>
070     * @param name
071     * @param group
072     */
073    void removeFromGroup( K name, String group );
074
075    /**
076     * Gets the set of keys of objects currently in the group
077     * <p>
078     * @param group
079     * @return the set of group keys.
080     */
081    Set<K> getGroupKeys( String group );
082
083    /**
084     * Invalidates a group
085     * <p>
086     * @param group
087     */
088    void invalidateGroup( String group );
089}