Class EhCacheBasedUserCache
- java.lang.Object
-
- org.springframework.security.core.userdetails.cache.EhCacheBasedUserCache
-
-
Constructor Summary
Constructors Constructor Description EhCacheBasedUserCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
net.sf.ehcache.Ehcache
getCache()
UserDetails
getUserFromCache(java.lang.String username)
Obtains aUserDetails
from the cache.void
putUserInCache(UserDetails user)
Places aUserDetails
in the cache.void
removeUserFromCache(java.lang.String username)
Removes the specified user from the cache.void
removeUserFromCache(UserDetails user)
void
setCache(net.sf.ehcache.Ehcache cache)
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getCache
public net.sf.ehcache.Ehcache getCache()
-
getUserFromCache
public UserDetails getUserFromCache(java.lang.String username)
Description copied from interface:UserCache
Obtains aUserDetails
from the cache.- Specified by:
getUserFromCache
in interfaceUserCache
- Parameters:
username
- theUser.getUsername()
used to place the user in the cache- Returns:
- the populated
UserDetails
ornull
if the user could not be found or if the cache entry has expired
-
putUserInCache
public void putUserInCache(UserDetails user)
Description copied from interface:UserCache
Places aUserDetails
in the cache. Theusername
is the key used to subsequently retrieve theUserDetails
.- Specified by:
putUserInCache
in interfaceUserCache
- Parameters:
user
- the fully populatedUserDetails
to place in the cache
-
removeUserFromCache
public void removeUserFromCache(UserDetails user)
-
removeUserFromCache
public void removeUserFromCache(java.lang.String username)
Description copied from interface:UserCache
Removes the specified user from the cache. Theusername
is the key used to remove the user. If the user is not found, the method should simply return (not thrown an exception).Some cache implementations may not support eviction from the cache, in which case they should provide appropriate behaviour to alter the user in either its documentation, via an exception, or through a log message.
- Specified by:
removeUserFromCache
in interfaceUserCache
- Parameters:
username
- to be evicted from the cache
-
setCache
public void setCache(net.sf.ehcache.Ehcache cache)
-
-