Browse Source

Merge pull request #1387 from michael-simons:SPR-15449

* pr/1387:
  Polish "Improve unless condition in caching doc"
  Improve unless condition in caching doc
pull/1392/head
Stephane Nicoll 9 years ago
parent
commit
135651de9a
  1. 5
      src/docs/asciidoc/integration.adoc

5
src/docs/asciidoc/integration.adoc

@ -8327,11 +8327,12 @@ supported wrapper so the previous example can be rewritten as follows: @@ -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

Loading…
Cancel
Save