Skip to content

Commit c35ddf9

Browse files
michael-simonssnicoll
authored andcommitted
Improve unless condition in caching doc
See gh-1387
1 parent d866715 commit c35ddf9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/asciidoc/integration.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8506,11 +8506,11 @@ supported wrapper so the previous example can be rewritten as follows:
85068506
[source,java,indent=0]
85078507
[subs="verbatim,quotes"]
85088508
----
8509-
@Cacheable(cacheNames="book", condition="#name.length() < 32", **unless="#result.hardback"**)
8509+
@Cacheable(cacheNames="book", condition="#name.length() < 32", **unless="#result?.hardback"**)
85108510
public Optional<Book> findBook(String name)
85118511
----
85128512

8513-
Note that `result` still refers to `Book` and not `Optional`.
8513+
Note that `result` still refers to `Book` and not `Optional`. Also, we are using the safe navigation operator here to accommodate the fact that the `Optional` maybe empty.
85148514

85158515
[[cache-spel-context]]
85168516
===== Available caching SpEL evaluation context

0 commit comments

Comments
 (0)