public class CacheUserProfileService extends Object implements UserProfileService
UserProfile
cache.
The cache is an AsyncLoadingCache
, which loads entries asynchronously.Constructor and Description |
---|
CacheUserProfileService(UserProfileService userProfileService,
com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine,
Duration maximumTimeout)
Creates a new CacheUserProfileService.
|
Modifier and Type | Method and Description |
---|---|
Promise<UserProfile,UserProfileException> |
getUserProfile(Context context,
String username)
Returns a promise that will be completed with an
UserProfile or with an UserProfileException
in case of errors. |
public CacheUserProfileService(UserProfileService userProfileService, com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, Duration maximumTimeout)
userProfileService
- The UserProfileService
to execute when a UserProfile
is not found in the cachecaffeine
- The parameters of the underlying cachemaximumTimeout
- The maximum time to cache a user profile. Cannot be null
.public Promise<UserProfile,UserProfileException> getUserProfile(Context context, String username)
UserProfileService
UserProfile
or with an UserProfileException
in case of errors.getUserProfile
in interface UserProfileService
context
- The request context.username
- The username that identifies the user to retrieve the profile attributes for.UserProfile
or with an ResourceException
in case
of errors.Copyright 2011-2017 ForgeRock AS.