Class SessionCacheService

  • All Implemented Interfaces:
    CacheService

    public class SessionCacheService
    extends Object
    implements CacheService
    Service to manage session caches.

    A session cache is a cache whose lifetime span over the session of a user in Silverpeas. As such, a session cache belongs to a given user and should be initialized at the user session opening.

    Author:
    mmoquillon
    • Constructor Detail

      • SessionCacheService

        public SessionCacheService()
    • Method Detail

      • newSessionCache

        public SimpleCache newSessionCache​(User user)
        Creates a new session cache for the specified user and sets it as the cache of the current session.
        Parameters:
        user - a Silverpeas user for which a session has to be opened.
        Returns:
        the session cache.
      • setCurrentSessionCache

        public void setCurrentSessionCache​(SimpleCache sessionCache)
        Sets the specified session cache as the current one. This is a technical method that shouldn't be used by business operations. It could be removed in the future according to the evolution of the implementation of the cache sessions.
        Parameters:
        sessionCache - the cache session to set.
        Throws:
        IllegalArgumentException - if the specified cache isn't a session cache already initialized by the session cache management mechanism.
      • getCurrentSessionCache

        public SimpleCache getCurrentSessionCache()
        Gets the cache mapped with the current user session.
        Returns:
        the current session cache.
      • getUser

        public User getUser​(SimpleCache sessionCache)
        Gets the user for whom the specified session cache has been created.
        Parameters:
        sessionCache - a session cache.
        Returns:
        the user to whom the specified session cache belongs.
        Throws:
        IllegalArgumentException - if the specified cache isn't a session cache correctly initialized.
      • clearAllCaches

        public void clearAllCaches()
        Description copied from interface: CacheService
        Clears all the caches on which this service works.
        Specified by:
        clearAllCaches in interface CacheService