Class ManageCacheService

java.lang.Object
fr.paris.lutece.portal.service.cache.ManageCacheService

@ApplicationScoped public class ManageCacheService extends Object
  • Constructor Details

    • ManageCacheService

      public ManageCacheService()
  • Method Details

    • registerCacheableService

      public <K, V> void registerCacheableService(CacheableService<K,V> cs)
      Registers a cacheable service in the registry.

      This method adds the provided cacheable service to the registry if a service with the same name is not already present. The cache status is determined and applied to the service based on its current configuration and status read from a file.

      Type Parameters:
      K - the type of cache keys
      V - the type of cache values
      Parameters:
      cs - the cacheable service to register
    • isCacheExist

      public <K, V> boolean isCacheExist(String cacheName)
      Checks if a cache with the specified name exists in the registry.

      This method checks whether a cacheable service with the given name is present in the registry. This helps determine if a cache can be accessed or managed.

      Parameters:
      cacheName - the name of the cache
      Returns:
      true if a cache with the specified name exists; false otherwise
    • getCache

      public <K, V> CacheableService<K,V> getCache(String cacheName)
      Retrieves a cacheable service by its name from the registry.

      This method returns the cacheable service associated with the specified name. The returned service is cast to the appropriate type based on the generic parameters.

      Type Parameters:
      K - the type of cache keys
      V - the type of cache values
      Parameters:
      cacheName - the name of the cache
      Returns:
      the cacheable service associated with the name, or null if no such service exists
    • getCacheableServicesList

      public List<CacheableService<?,?>> getCacheableServicesList()
      Returns all registered Cacheable services
      Returns:
      A collection containing all registered Cacheable services
    • resetCaches

      public void resetCaches()
      Reset all caches
    • refreshStatuses

      public void refreshStatuses()
      Applies to this instance the status of each cache saved in the database. With several instances sharing their caches, a cache enabled or disabled from the back office of one instance is then enabled or disabled on the others too. A cache whose status is unchanged is not touched; a failure on a cache does not stop the others.