Package org.opencms.monitor
Class CmsGroupListCache
java.lang.Object
org.opencms.monitor.CmsGroupListCache
- All Implemented Interfaces:
I_CmsMemoryMonitorable
Cache for users' groups and data derived from those groups, like role membership.
The cache can be either flushed completely, or just for a single user id. The data for a user must be flushed when their group membership changes.
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Max cached group lists per user. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all cache entries.void
Removes the cache entries for the given user id.getBareRoles
(CmsUUID userId) Gets the cached bare roles for the given user id, or null if none are cached.Gets the cached user groups for the given combination of keys, or null if nothing is cached.getHasRole
(CmsUUID userId, String roleKey) Gets the cached role membership for the given role key, or null if nothing is cached.int
Returns the memory size of the object.void
setBareRoles
(CmsUser user, List<CmsRole> bareRoles) Sets the bare roles for a user (with no OU information).void
Caches a new value for the given combination of keys.void
setHasRole
(CmsUser user, String roleKey, Boolean value) Caches the role membership for the given user id and role key.int
size()
Returns the number of user ids for which group lists are cached.
-
Field Details
-
GROUP_LISTS_PER_USER
Max cached group lists per user. Non-final, so can be adjusted at runtime.
-
-
Constructor Details
-
CmsGroupListCache
Creates a new cache instance.- Parameters:
size
- the maximum size
-
-
Method Details
-
clear
Removes all cache entries. -
clearUser
Removes the cache entries for the given user id.- Parameters:
idKey
- the user id
-
getBareRoles
Gets the cached bare roles for the given user id, or null if none are cached.These are just the roles of the user, but with no OU information.
- Parameters:
userId
- the user id- Returns:
- the bare roles for the user
-
getGroups
Gets the cached user groups for the given combination of keys, or null if nothing is cached.- Parameters:
userId
- the user idsubKey
- a string that consists of the parameters/flags for the group reading operation- Returns:
- the groups for the given combination of keys
-
getHasRole
Gets the cached role membership for the given role key, or null if nothing is cached.- Parameters:
userId
- the user idroleKey
- the role key- Returns:
- the cached role membership
-
getMemorySize
Description copied from interface:I_CmsMemoryMonitorable
Returns the memory size of the object.- Specified by:
getMemorySize
in interfaceI_CmsMemoryMonitorable
- Returns:
- the memory size of the object
- See Also:
-
setBareRoles
Sets the bare roles for a user (with no OU information).- Parameters:
user
- the userbareRoles
- the list of bare roles
-
setGroups
Caches a new value for the given combination of keys.- Parameters:
user
- the usersubKey
- a string that consists of the parameters/flags for the group reading operationgroups
- the value to cache
-
setHasRole
Caches the role membership for the given user id and role key.- Parameters:
user
- the userroleKey
- the role keyvalue
- the role membership value
-
size
Returns the number of user ids for which group lists are cached.- Returns:
- the number of user ids for which group lists are cached
-