com.atlassian.user.impl.cache
Class MembershipCache

java.lang.Object
  extended bycom.atlassian.user.impl.cache.MembershipCache

public class MembershipCache
extends java.lang.Object

The membership check cache is a cache where the key is the String returned by getMembershipKey(String, Group) for a given user and group, and the value is a Boolean indicating whether the user is a member of that group.

Both true and false membership checks are cached.


Constructor Summary
MembershipCache(com.atlassian.cache.CacheFactory cacheFactory, java.lang.String cacheName)
           
 
Method Summary
 java.lang.Boolean get(User user, Group group)
           
protected  java.lang.String getMembershipKey(java.lang.String username, Group group)
           
 void put(User user, Group group, boolean isMember)
           
 void remove(java.util.List usernames, Group group)
          Remove all cached values for a list of users and an associated group.
 void remove(User user, Group group)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MembershipCache

public MembershipCache(com.atlassian.cache.CacheFactory cacheFactory,
                       java.lang.String cacheName)
Method Detail

getMembershipKey

protected java.lang.String getMembershipKey(java.lang.String username,
                                            Group group)

put

public void put(User user,
                Group group,
                boolean isMember)

get

public java.lang.Boolean get(User user,
                             Group group)
Returns:
Boolean.TRUE if the user is a member of the group, Boolean.FALSE if the user is not a member of the group, or null if the result is not in the cache.

remove

public void remove(User user,
                   Group group)

remove

public void remove(java.util.List usernames,
                   Group group)
Remove all cached values for a list of users and an associated group. Typically called to remove all membership information when a group is removed.

Parameters:
usernames - a List of username Strings.
group - the group of which the users are members.


Copyright © 2005-2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.