Merge pull request #1387 from michael-simons:SPR-15449
* pr/1387: Polish "Improve unless condition in caching doc" Improve unless condition in caching doc
This commit is contained in:
@@ -8327,11 +8327,12 @@ supported wrapper so the previous example can be rewritten as follows:
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
@Cacheable(cacheNames="book", condition="#name.length() < 32", **unless="#result.hardback"**)
|
||||
@Cacheable(cacheNames="book", condition="#name.length() < 32", **unless="#result?.hardback"**)
|
||||
public Optional<Book> findBook(String name)
|
||||
----
|
||||
|
||||
Note that `result` still refers to `Book` and not `Optional`.
|
||||
Note that `result` still refers to `Book` and not `Optional`. As it might be `null`, we
|
||||
should use the safe navigation operator.
|
||||
|
||||
[[cache-spel-context]]
|
||||
===== Available caching SpEL evaluation context
|
||||
|
||||
Reference in New Issue
Block a user