Class CacheUserProfileService
java.lang.Object
org.forgerock.openig.tools.userprofile.CacheUserProfileService
- All Implemented Interfaces:
UserProfileService
Create a CacheUserProfileService which is responsible for managing the
UserProfile
cache.
The cache is an AsyncCache
, which loads entries asynchronously.-
Constructor Summary
ConstructorDescriptionCacheUserProfileService
(UserProfileService userProfileService, com.github.benmanes.caffeine.cache.Caffeine<Object, Object> caffeine, Duration maximumTimeout) Creates a new CacheUserProfileService. -
Method Summary
Modifier and TypeMethodDescriptiongetUserProfile
(Context context, String username) Returns a promise that will be completed with anUserProfile
or with anUserProfileException
in case of errors.
-
Constructor Details
-
CacheUserProfileService
public CacheUserProfileService(UserProfileService userProfileService, com.github.benmanes.caffeine.cache.Caffeine<Object, Object> caffeine, Duration maximumTimeout) Creates a new CacheUserProfileService.- Parameters:
userProfileService
- TheUserProfileService
to execute when aUserProfile
is not found in the cachecaffeine
- The parameters of the underlying cachemaximumTimeout
- The maximum time to cache a user profile. Cannot benull
.
-
-
Method Details
-
getUserProfile
Description copied from interface:UserProfileService
Returns a promise that will be completed with anUserProfile
or with anUserProfileException
in case of errors.- Specified by:
getUserProfile
in interfaceUserProfileService
- Parameters:
context
- The request context.username
- The username that identifies the user to retrieve the profile attributes for.- Returns:
- a promise that will be completed with
UserProfile
or with anResourceException
in case of errors.
-