Package org.wicketstuff.security.hive
Class SimpleCachingHive
- java.lang.Object
-
- org.wicketstuff.security.hive.BasicHive
-
- org.wicketstuff.security.hive.SimpleCachingHive
-
- All Implemented Interfaces:
Hive
public class SimpleCachingHive extends BasicHive
A very simple caching mechanism on top ofBasicHive. If you want more control over your cache you could for example use EHCache and extend BasicHive yourself. This cache is cleared when a subject logs off but no guarantees are given that the cache will not be cleared prematurely or how long it takes after a user logs off to clear the cached results.- Author:
- marrink
-
-
Constructor Summary
Constructors Constructor Description SimpleCachingHive()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BooleancacheLookUp(Subject subject, Permission permission)Allows subclasses to retrieve previously cached results and thus speed up the check.protected voidcacheResult(Subject subject, Permission permission, boolean result)Allows subclasses to cache the result of a check and thus speed up this check the next time.-
Methods inherited from class org.wicketstuff.security.hive.BasicHive
addPermission, addPrincipal, containsPermission, containsPrincipal, getPermissions, getPrincipals, hasPermission, isLocked, lock
-
-
-
-
Method Detail
-
cacheLookUp
protected Boolean cacheLookUp(Subject subject, Permission permission)
Description copied from class:BasicHiveAllows subclasses to retrieve previously cached results and thus speed up the check. By default null is returned, meaning no cached value- Overrides:
cacheLookUpin classBasicHive- Parameters:
subject- (optional) subjectpermission- the permission to check- Returns:
- null if there is no cached value, true if the permission is granted, false if the permission is denied
-
cacheResult
protected void cacheResult(Subject subject, Permission permission, boolean result)
Description copied from class:BasicHiveAllows subclasses to cache the result of a check and thus speed up this check the next time. By default this method does not have an implementation.- Overrides:
cacheResultin classBasicHive- Parameters:
subject- (optional) subjectpermission- the permission to checkresult- the result of the permission
-
-