Class CacheManager

java.lang.Object
com.michelin.cert.redscan.utils.caching.CacheManager

public class CacheManager extends Object
Cache management.
Author:
Maxime ESCOURBIAC
  • Field Details

    • applicationName

      protected String applicationName
    • cacheManagerUrl

      protected String cacheManagerUrl
  • Constructor Details

    • CacheManager

      public CacheManager()
      CacheManager default constructor.
    • CacheManager

      public CacheManager(String applicationName, String cacheManagerUrl)
      CacheManager constructor.
      Parameters:
      applicationName - Application Name to avoid conflict in cache.
      cacheManagerUrl - Cache Manager url (ex: http://127.0.0.1:8080 )
  • Method Details

    • buildKey

      public String buildKey(String... keyValues)
      Generate a unique key for the cache. WARNING : MUST CONTAINS
      Parameters:
      keyValues - Key values.
      Returns:
      Unique key.
    • getCache

      public Map<String,String> getCache(String key, int validity)
      Get cache entry.
      Parameters:
      key - Cache key to retrieve.
      validity - validity in hours.
      Returns:
      The retrieve cache.
    • setCache

      public boolean setCache(String key, Map<String,String> values)
      Set cache entry.
      Parameters:
      key - Cache key to retrieve.
      values - Values to cache.
      Returns:
      True if cached.