Class GroupCache


  • @Technical
    @Bean
    @Singleton
    public class GroupCache
    extends Object
    Cache of user groups.
    • Constructor Detail

      • GroupCache

        public GroupCache()
    • Method Detail

      • clearCache

        public void clearCache()
        Clears the cache.
      • getAllGroupIdsOfUser

        public Optional<List<String>> getAllGroupIdsOfUser​(String userId)
        Gets all the groups in which the specified user is part of.
        Parameters:
        userId - the unique identifier of a user.
        Returns:
        a list of group identifiers.
      • setAllGroupIdsOfUser

        public List<String> setAllGroupIdsOfUser​(String userId,
                                                 List<String> groupIds)
        Sets the specified groups as being those in which the given user is part of. If the user has already a list of groups set, then nothing is done and that list is returned. Otherwise, the groups are cached as being the groups in which the user is part of and then returned.
        Parameters:
        userId - the unique identifier of a user.
        groupIds - a list with the unique identifier of the groups.
        Returns:
        either the specified list of group identifiers or the one that is already cached.
      • removeCacheOfUser

        public void removeCacheOfUser​(String userId)
        Removes from the cache the specified user and therefore the groups in which he's part of.
        Parameters:
        userId - the unique identifier of a user.