Class CacheUserProfileService

  • All Implemented Interfaces:
    UserProfileService

    public class CacheUserProfileService
    extends Object
    implements UserProfileService
    Create a CacheUserProfileService which is responsible for managing the UserProfile cache. The cache is an AsyncCache, which loads entries asynchronously.
    • Constructor Detail

      • CacheUserProfileService

        public CacheUserProfileService​(UserProfileService userProfileService,
                                       com.github.benmanes.caffeine.cache.Caffeine<Object,​Object> caffeine,
                                       Duration maximumTimeout)
        Creates a new CacheUserProfileService.
        Parameters:
        userProfileService - The UserProfileService to execute when a UserProfile is not found in the cache
        caffeine - The parameters of the underlying cache
        maximumTimeout - The maximum time to cache a user profile. Cannot be null.
    • 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 an UserProfile or with an UserProfileException in case of errors.
        Specified by:
        getUserProfile in interface UserProfileService
        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 an ResourceException in case of errors.