Annotation Interface LuteceCache


@Qualifier @Retention(RUNTIME) @Target({TYPE,FIELD,PARAMETER,METHOD}) public @interface LuteceCache
The @LuteceCache annotation is used to inject a cache instance into a component or method in the Lutece framework. This annotation helps to configure and manage cache instances by specifying cache properties and types directly in the code.

When applied, this annotation allows the retrieval and injection of a cache instance based on the specified cache name and type parameters.

Example usage:

 
 @Inject
 @LuteceCache(cacheName = "myCache", keyType = Integer.class, valueType = String.class, enable = enable)
 Lutece107Cache<Integer, String> myCacheInstance;
 
 

In the example above, the annotation is used to inject a cache instance named "myCache" with keys of type Integer and values of type String. The cache instance is then available for use in the myCacheInstance field.

Attributes:

  • cacheName: The name of the cache to be injected. This is a required attribute.
  • keyType: The type of the cache keys. Defaults to Object.class if not specified.
  • valueType: The type of the cache values. Defaults to Object.class if not specified.
  • enable: A boolean flag indicating whether the cache injection should be enabled. Defaults to false.

This annotation is particularly useful for configuring and managing caches in a dependency injection context, ensuring that the correct cache instance is injected based on the specified configuration.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name of the cache to be injected.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Flag indicating whether cache injection is enabled.
    The type of keys used in the cache.
    boolean
    Flag indicating whether the cache can be reset by global cache resets
    The type of values used in the cache.
  • Element Details

    • cacheName

      String cacheName
      The name of the cache to be injected.
      Returns:
      the cache name
    • keyType

      Class<?> keyType
      The type of keys used in the cache.
      Returns:
      the key type
      Default:
      java.lang.Object.class
    • valueType

      Class<?> valueType
      The type of values used in the cache.
      Returns:
      the value type
      Default:
      java.lang.Object.class
    • enable

      boolean enable
      Flag indicating whether cache injection is enabled.
      Returns:
      true if cache injection is enabled, false otherwise
      Default:
      false
    • preventGlobalReset

      boolean preventGlobalReset
      Flag indicating whether the cache can be reset by global cache resets
      Returns:
      true if cache reset is prevented, false otherwise
      Default:
      false