org.apache.jcs.access
Class GroupCacheAccess<K extends Serializable,V extends Serializable>

java.lang.Object
  extended by org.apache.jcs.access.CacheAccess<K,V>
      extended by org.apache.jcs.access.GroupCacheAccess<K,V>
All Implemented Interfaces:
ICacheAccess<K,V>, IGroupCacheAccess<K,V>
Direct Known Subclasses:
JCS

public class GroupCacheAccess<K extends Serializable,V extends Serializable>
extends CacheAccess<K,V>
implements IGroupCacheAccess<K,V>

Access for groups.


Field Summary
 
Fields inherited from class org.apache.jcs.access.CacheAccess
cacheControl
 
Constructor Summary
GroupCacheAccess(CompositeCache<K,V> cacheControl)
          Constructor for the GroupCacheAccess object
 
Method Summary
 V getFromGroup(K name, String group)
          Gets an item out of the cache that is in a specified group.
static
<K extends Serializable,V extends Serializable>
GroupCacheAccess<K,V>
getGroupAccess(String region)
          Gets the groupAccess attribute of the GroupCacheAccess class.
static
<K extends Serializable,V extends Serializable>
GroupCacheAccess<K,V>
getGroupAccess(String region, ICompositeCacheAttributes icca)
          Gets the groupAccess attribute of the GroupCacheAccess class.
 Set<K> getGroupKeys(String group)
          Gets the set of keys of objects currently in the group.
 Set<String> getGroupNames()
          Gets the set of group names in the cache
 void invalidateGroup(String group)
          Invalidates a group: remove all the group members
 void putInGroup(K name, String groupName, V value)
          Allows the user to put an object into a group within a particular cache region.
 void putInGroup(K name, String groupName, V value, IElementAttributes attr)
          Allows the user to put an object into a group within a particular cache region.
 void remove(K name, String group)
          Remove the item from this group in this region by this name.
 
Methods inherited from class org.apache.jcs.access.CacheAccess
clear, defineRegion, defineRegion, defineRegion, destroy, destroy, dispose, freeMemoryElements, get, getAccess, getAccess, getCacheAttributes, getCacheElement, getCacheElements, getCacheManager, getDefaultElementAttributes, getElementAttributes, getElementAttributes, getMatching, getMatchingCacheElements, getStatistics, getStats, put, put, putSafe, remove, remove, resetElementAttributes, resetElementAttributes, setCacheAttributes, setDefaultElementAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupCacheAccess

public GroupCacheAccess(CompositeCache<K,V> cacheControl)
Constructor for the GroupCacheAccess object

Parameters:
cacheControl -
Method Detail

getGroupAccess

public static <K extends Serializable,V extends Serializable> GroupCacheAccess<K,V> getGroupAccess(String region)
                                                                                      throws CacheException
Gets the groupAccess attribute of the GroupCacheAccess class.

Parameters:
region -
Returns:
The groupAccess value
Throws:
CacheException

getGroupAccess

public static <K extends Serializable,V extends Serializable> GroupCacheAccess<K,V> getGroupAccess(String region,
                                                                                                   ICompositeCacheAttributes icca)
                                                                                      throws CacheException
Gets the groupAccess attribute of the GroupCacheAccess class.

Parameters:
region -
icca -
Returns:
The groupAccess value
Throws:
CacheException

getFromGroup

public V getFromGroup(K name,
                      String group)
Gets an item out of the cache that is in a specified group.

Specified by:
getFromGroup in interface IGroupCacheAccess<K extends Serializable,V extends Serializable>
Parameters:
name - The key name.
group - The group name.
Returns:
The cached value, null if not found.

putInGroup

public void putInGroup(K name,
                       String groupName,
                       V value)
                throws CacheException
Allows the user to put an object into a group within a particular cache region. This method sets the object's attributes to the default for the region.

Specified by:
putInGroup in interface IGroupCacheAccess<K extends Serializable,V extends Serializable>
Parameters:
name - The key name.
groupName - The group name.
value - The object to cache
Throws:
CacheException

putInGroup

public void putInGroup(K name,
                       String groupName,
                       V value,
                       IElementAttributes attr)
                throws CacheException
Allows the user to put an object into a group within a particular cache region. This method allows the object's attributes to be individually specified.

Specified by:
putInGroup in interface IGroupCacheAccess<K extends Serializable,V extends Serializable>
Parameters:
name - The key name.
groupName - The group name.
value - The object to cache
attr - The objects attributes.
Throws:
CacheException

remove

public void remove(K name,
                   String group)
Description copied from interface: IGroupCacheAccess
Remove the item from this group in this region by this name.

Specified by:
remove in interface IGroupCacheAccess<K extends Serializable,V extends Serializable>
Parameters:
name -
group -

getGroupKeys

public Set<K> getGroupKeys(String group)
Gets the set of keys of objects currently in the group.

Specified by:
getGroupKeys in interface IGroupCacheAccess<K extends Serializable,V extends Serializable>
Parameters:
group -
Returns:
A Set of keys.

getGroupNames

public Set<String> getGroupNames()
Gets the set of group names in the cache

Returns:
A Set of group names.

invalidateGroup

public void invalidateGroup(String group)
Invalidates a group: remove all the group members

Specified by:
invalidateGroup in interface IGroupCacheAccess<K extends Serializable,V extends Serializable>
Parameters:
group - The name of the group to invalidate


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.