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
ConstructorsConstructorDescriptionCacheUserProfileService
(UserProfileService userProfileService, CaffeineAsyncCache.Builder<String, UserProfile, UserProfileException> cacheBuilder, 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, CaffeineAsyncCache.Builder<String, UserProfile, UserProfileException> cacheBuilder, Duration maximumTimeout) Creates a new CacheUserProfileService.- Parameters:
userProfileService
- TheUserProfileService
to execute when aUserProfile
is not found in the cachecacheBuilder
- The cache builder to use. Cannot benull
.maximumTimeout
- 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.
-