Class ResourceCacheService

java.lang.Object
fr.paris.lutece.portal.service.cache.AbstractCacheableService<String,Object>
fr.paris.lutece.plugins.resource.service.ResourceCacheService
All Implemented Interfaces:
fr.paris.lutece.portal.service.cache.CacheableService<String,Object>, fr.paris.lutece.portal.service.cache.Lutece107Cache<String,Object>, fr.paris.lutece.portal.service.util.LuteceService, Closeable, Serializable, AutoCloseable, Iterable<javax.cache.Cache.Entry<String,Object>>, javax.cache.Cache<String,Object>

@ApplicationScoped public class ResourceCacheService extends fr.paris.lutece.portal.service.cache.AbstractCacheableService<String,Object>
Cache service for resources, resource types and resources providers
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface javax.cache.Cache

    javax.cache.Cache.Entry<K extends Object,V extends Object>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    get(String key)
    .
    static String
    Get the cache key for resources.
    static String
    getResourceCacheKey(String strIdResource, String strResourceType)
    Get the cache key for resources
    static String
    Get the cache for resource types
    static String
    Get the cache key of the association between a resource provider and a resource type
    static String
    Get the cache key for the list of resource types
    void
     
    void
    put(String key, Object value)
    .
    boolean
    .

    Methods inherited from class fr.paris.lutece.portal.service.cache.AbstractCacheableService

    clear, close, containsKey, deregisterCacheEntryListener, enableCache, getAll, getAndPut, getAndRemove, getAndReplace, getCache, getCacheManager, getCacheSize, getConfiguration, getFromCache, getInfos, getKeys, initCache, initCache, initCache, invoke, invokeAll, isCacheEnable, isClosed, isPreventGlobalReset, isPreventReset, isRequired, iterator, loadAll, putAll, putIfAbsent, putInCache, registerCacheEntryListener, remove, removeAll, removeAll, removeKey, replace, replace, resetCache, setCache, unwrap

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface fr.paris.lutece.portal.service.cache.CacheableService

    getMaxElements, getMemorySize, getTimeToLive

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

    • ResourceCacheService

      public ResourceCacheService()
  • Method Details

    • init

      @PostConstruct public void init()
    • put

      public void put(String key, Object value)
      . A provider failure is logged: the caller goes on without the cache
      Specified by:
      put in interface javax.cache.Cache<String,Object>
      Overrides:
      put in class fr.paris.lutece.portal.service.cache.AbstractCacheableService<String,Object>
    • get

      public Object get(String key)
      . A provider failure is logged and read as a miss
      Specified by:
      get in interface javax.cache.Cache<String,Object>
      Overrides:
      get in class fr.paris.lutece.portal.service.cache.AbstractCacheableService<String,Object>
    • remove

      public boolean remove(String key)
      . No test of the status: a cache disabled on this instance still forwards the removal to the cache shared with the other instances (the core keeps it open for that)
      Specified by:
      remove in interface javax.cache.Cache<String,Object>
      Overrides:
      remove in class fr.paris.lutece.portal.service.cache.AbstractCacheableService<String,Object>
    • getName

      public String getName()
    • getResourceTypeProviderCacheKey

      public static String getResourceTypeProviderCacheKey(String strResourceType)
      Get the cache key of the association between a resource provider and a resource type
      Parameters:
      strResourceType - The resource type
      Returns:
      The cache key of the association between a resource provider and a resource type
    • getResourceTypesListCacheKey

      public static String getResourceTypesListCacheKey()
      Get the cache key for the list of resource types
      Returns:
      The cache key for the list of resource types
    • getResourceCacheKey

      public static String getResourceCacheKey(String strIdResource, String strResourceType)
      Get the cache key for resources
      Parameters:
      strIdResource - The id of the resource
      strResourceType - The resource type
      Returns:
      The cache key for the given resource
    • getDatabaseResourceCacheKey

      public static String getDatabaseResourceCacheKey(String strIdResource)
      Get the cache key for resources. This method should only be used to manage database resource type keys.
      To cache resources of any other providers, use the getResourceCacheKey(String strIdResource, String strResourceType) method.
      Parameters:
      strIdResource - The id of the resource
      Returns:
      The cache key for the given resource
    • getResourceTypeCacheKey

      public static String getResourceTypeCacheKey(String strResourceType)
      Get the cache for resource types
      Parameters:
      strResourceType - The resource type
      Returns:
      The cache key for the given resource type