Annotation 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 toObject.classif not specified.valueType: The type of the cache values. Defaults toObject.classif not specified.enable: A boolean flag indicating whether the cache injection should be enabled. Defaults tofalse.
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 -
Optional Element Summary
Optional Elements
-
Element Details
-
cacheName
String cacheNameThe name of the cache to be injected.- Returns:
- the cache name
-
-
-
keyType
Class<?> keyTypeThe type of keys used in the cache.- Returns:
- the key type
- Default:
- java.lang.Object.class
-
valueType
Class<?> valueTypeThe type of values used in the cache.- Returns:
- the value type
- Default:
- java.lang.Object.class
-
enable
boolean enableFlag indicating whether cache injection is enabled.- Returns:
trueif cache injection is enabled,falseotherwise
- Default:
- false
-
preventGlobalReset
boolean preventGlobalResetFlag indicating whether the cache can be reset by global cache resets- Returns:
trueif cache reset is prevented,falseotherwise
- Default:
- false
-