cache put operation.
In contrast to the @Cacheable annotation, this annotation
does not cause the advised method to be skipped. Rather, it always causes the
method to be invoked and its result to be stored in the associated cache if the
condition() and unless() expressions match accordingly. Note
that Java8's Optional return types are automatically handled and its
content is stored in the cache if present.
This annotation may be used as a meta-annotation to create custom composed annotations with attribute overrides.
CacheConfig
| Modifier and Type | Method and Description |
|---|---|
| public String | cacheManager()
The bean name of the custom |
| public String[] | |
| public String | cacheResolver()
The bean name of the custom |
| public String | condition()
Spring Expression Language (SpEL) expression used for making the cache put operation conditional. |
| public String | |
| public String | keyGenerator()
The bean name of the custom |
| public String | |
| public String[] |
| cacheManager | back to summary |
|---|---|
| public String cacheManager() The bean name of the custom Mutually exclusive with the | |
| cacheNames | back to summary |
|---|---|
| public String[] cacheNames() Names of the caches to use for the cache put operation. Names may be used to determine the target cache (or caches), matching the qualifier value or bean name of a specific bean definition.
| |
| cacheResolver | back to summary |
|---|---|
| public String cacheResolver() The bean name of the custom
| |
| condition | back to summary |
|---|---|
| public String condition() Spring Expression Language (SpEL) expression used for making the cache
put operation conditional. Update the cache if the condition evaluates to
This expression is evaluated after the method has been called due to the
nature of the put operation and can therefore refer to the Default is The SpEL expression evaluates against a dedicated context that provides the following meta-data:
| |
| key | back to summary |
|---|---|
| public String key() Spring Expression Language (SpEL) expression for computing the key dynamically. Default is The SpEL expression evaluates against a dedicated context that provides the following meta-data:
| |
| keyGenerator | back to summary |
|---|---|
| public String keyGenerator() The bean name of the custom Mutually exclusive with the
| |
| unless | back to summary |
|---|---|
| public String unless() Spring Expression Language (SpEL) expression used to veto the cache put operation.
Veto updating the cache if the condition evaluates to Default is The SpEL expression evaluates against a dedicated context that provides the following meta-data:
| |
| value | back to summary |
|---|---|
| public String[] value() Alias for
| |