Browse Source

Polish "Improve documentation of Cacheable"

Apply the same improvements to CacheEvict and CachePut.

See gh-28183
pull/28959/head
Stephane Nicoll 3 years ago
parent
commit
04209def46
  1. 5
      spring-context/src/main/java/org/springframework/cache/annotation/CacheEvict.java
  2. 6
      spring-context/src/main/java/org/springframework/cache/annotation/CachePut.java
  3. 7
      spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java

5
spring-context/src/main/java/org/springframework/cache/annotation/CacheEvict.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -111,7 +111,8 @@ public @interface CacheEvict { @@ -111,7 +111,8 @@ public @interface CacheEvict {
/**
* Spring Expression Language (SpEL) expression used for making the cache
* eviction operation conditional.
* eviction operation conditional. Evict that cache if the condition evaluates
* to {@code true}.
* <p>Default is {@code ""}, meaning the cache eviction is always performed.
* <p>The SpEL expression evaluates against a dedicated context that provides the
* following meta-data:

6
spring-context/src/main/java/org/springframework/cache/annotation/CachePut.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -118,7 +118,8 @@ public @interface CachePut { @@ -118,7 +118,8 @@ public @interface CachePut {
/**
* Spring Expression Language (SpEL) expression used for making the cache
* put operation conditional.
* put operation conditional. Update the cache if the condition evaluates to
* {@code true}.
* <p>This expression is evaluated after the method has been called due to the
* nature of the put operation and can therefore refer to the {@code result}.
* <p>Default is {@code ""}, meaning the method result is always cached.
@ -142,6 +143,7 @@ public @interface CachePut { @@ -142,6 +143,7 @@ public @interface CachePut {
/**
* Spring Expression Language (SpEL) expression used to veto the cache put operation.
* Veto updating the cache if the condition evaluates to {@code true}.
* <p>Default is {@code ""}, meaning that caching is never vetoed.
* <p>The SpEL expression evaluates against a dedicated context that provides the
* following meta-data:

7
spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -123,8 +123,8 @@ public @interface Cacheable { @@ -123,8 +123,8 @@ public @interface Cacheable {
/**
* Spring Expression Language (SpEL) expression used for making the method
* caching conditional. If condition is evaluated to {@code true}, result
* is cached.
* caching conditional. Cache the result if the condition evaluates to
* {@code true}.
* <p>Default is {@code ""}, meaning the method result is always cached.
* <p>The SpEL expression evaluates against a dedicated context that provides the
* following meta-data:
@ -143,6 +143,7 @@ public @interface Cacheable { @@ -143,6 +143,7 @@ public @interface Cacheable {
/**
* Spring Expression Language (SpEL) expression used to veto method caching.
* Veto caching the result if the condition evaluates to {@code true}.
* <p>Unlike {@link #condition}, this expression is evaluated after the method
* has been called and can therefore refer to the {@code result}.
* <p>Default is {@code ""}, meaning that caching is never vetoed.

Loading…
Cancel
Save