Skip to content

SPR-15449 - Improve unless condition and hint #1387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/docs/asciidoc/integration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8327,11 +8327,11 @@ 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`. Also, we are using the safe navigation operator here to accommodate the fact that the `Optional` maybe empty.

[[cache-spel-context]]
===== Available caching SpEL evaluation context
Expand Down