Class CacheUserProfileService
- java.lang.Object
-
- org.forgerock.openig.tools.userprofile.CacheUserProfileService
-
- All Implemented Interfaces:
UserProfileService
public class CacheUserProfileService extends Object implements UserProfileService
Create a CacheUserProfileService which is responsible for managing theUserProfile
cache. The cache is anAsyncCache
, which loads entries asynchronously.
-
-
Constructor Summary
Constructors Constructor Description CacheUserProfileService(UserProfileService userProfileService, com.github.benmanes.caffeine.cache.Caffeine<Object,Object> caffeine, Duration maximumTimeout)
Creates a new CacheUserProfileService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<UserProfile,UserProfileException>
getUserProfile(Context context, String username)
Returns a promise that will be completed with anUserProfile
or with anUserProfileException
in case of errors.
-
-
-
Constructor Detail
-
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 Detail
-
getUserProfile
public Promise<UserProfile,UserProfileException> getUserProfile(Context context, String username)
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.
-
-