Class CacheConfigUtil

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

public class CacheConfigUtil extends Object
Utility class for configuring and managing cache settings.
  • Field Details

  • Constructor Details

    • CacheConfigUtil

      public CacheConfigUtil()
  • Method Details

    • preConfigureCacheManager

      public static URI preConfigureCacheManager(String uriValue, javax.cache.spi.CachingProvider cachingProvider, Properties properties) throws IOException
      Pre-configures a cache manager with the given URI, caching provider, and properties.
      Parameters:
      uriValue - The URI value for the cache configuration.
      cachingProvider - The caching provider.
      properties - The properties to configure the cache.
      Returns:
      The configured URI.
      Throws:
      IOException - If an I/O error occurs.
    • generateOrUpdateEhCacheConfig

      public static URI generateOrUpdateEhCacheConfig() throws IOException
      Generates or updates the Ehcache configuration.
      Returns:
      The URI of the generated or updated Ehcache configuration.
      Throws:
      IOException - If an I/O error occurs.
    • createTempEhcacheConfigFile

      public static URI createTempEhcacheConfigFile(List<fr.paris.lutece.portal.service.cache.CacheConfigUtil.CacheConfig> cacheConfigs, fr.paris.lutece.portal.service.cache.CacheConfigUtil.CacheConfig defaultCacheConfig) throws IOException
      Creates a temporary Ehcache configuration file.
      Parameters:
      cacheConfigs - The list of cache configurations.
      defaultCacheConfig - The default cache configuration.
      Returns:
      The URI of the created configuration file.
      Throws:
      IOException - If an I/O error occurs.
    • getCahesConfigs

      public static List<fr.paris.lutece.portal.service.cache.CacheConfigUtil.CacheConfig> getCahesConfigs()
      Retrieves cache configurations.
      Returns:
      A list of cache configurations.
    • getConfigPropertiesWithPrefix

      public static Map<String,String> getConfigPropertiesWithPrefix()
      Builds the cache configuration map.
      Returns:
      A map of cache configurations.
    • buildCacheConfigs

      public static List<fr.paris.lutece.portal.service.cache.CacheConfigUtil.CacheConfig> buildCacheConfigs(Map<String,String> properties)
      Builds a list of cache configurations from the given properties map.
      Parameters:
      properties - A map of properties where keys represent cache configuration parameters.
      Returns:
      A list of CacheConfigUtil.CacheConfig objects configured according to the given properties.
    • determineCaheName

      public static Set<String> determineCaheName(Set<String> keys)
      Determines the unique cache name prefixes from a set of property keys.
      Parameters:
      keys - A set of property keys.
      Returns:
      A set of unique cache name prefixes extracted from the keys.
    • getStatusFromDataBase

      public static boolean getStatusFromDataBase(String cacheName)
      Returns the cache status froms database
      Parameters:
      cs - The cacheable service
      Returns:
      The status
    • getDSKey

      public static String getDSKey(String strCacheName, String strProperty)
      Return the key of a datastore property
      Parameters:
      strCacheName - The cacheable service
      strProperty - The property
      Returns:
      The DS key
    • getInfos

      public static <K, V> String getInfos(javax.cache.configuration.Configuration<K,V> conf)
      Returns cache config
      Parameters:
      cache - The cache
      Returns:
      Cache infos