Skip to content

Commit 14d3525

Browse files
author
Lukasz Kryger
committed
Minor corrections/typos to "27. Cache Abstraction" docs section
1 parent c5f908b commit 14d3525

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/asciidoc/index.adoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45718,7 +45718,7 @@ do yourself a favour and read <<expressions>>:
4571845718
[source,java,indent=0]
4571945719
[subs="verbatim,quotes"]
4572045720
----
45721-
@Cacheable(value="books", **key="#isbn")**
45721+
@Cacheable(value="books", **key="#isbn"**)
4572245722
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
4572345723

4572445724
@Cacheable(value="books", **key="#isbn.rawNumber"**)
@@ -45728,7 +45728,7 @@ do yourself a favour and read <<expressions>>:
4572845728
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
4572945729
----
4573045730

45731-
The snippets above, show how easy it is to select a certain argument, one of its
45731+
The snippets above show how easy it is to select a certain argument, one of its
4573245732
properties or even an arbitrary (static) method.
4573345733

4573445734

@@ -45739,8 +45739,8 @@ might depend on the given arguments). The cache annotations support such functio
4573945739
through the `conditional` parameter which takes a `SpEL` expression that is evaluated to
4574045740
either `true` or `false`. If `true`, the method is cached - if not, it behaves as if the
4574145741
method is not cached, that is executed every since time no matter what values are in the
45742-
cache or what arguments are used. A quick example - the following method will be cached,
45743-
only if the argument `name` has a length shorter then 32:
45742+
cache or what arguments are used. A quick example - the following method will be cached
45743+
only if the argument `name` has a length shorter than 32:
4574445744

4574545745
[source,java,indent=0]
4574645746
[subs="verbatim,quotes"]
@@ -45769,7 +45769,7 @@ Each `SpEL` expression evaluates again a dedicated
4576945769
<<expressions-language-ref,`context`>>. In addition to the build in parameters, the
4577045770
framework provides dedicated caching related metadata such as the argument names. The
4577145771
next table lists the items made available to the context so one can use them for key and
45772-
conditional(see next section) computations:
45772+
conditional (see next section) computations:
4577345773

4577445774
[[cache-spel-context-tbl]]
4577545775
.Cache SpEL available metadata
@@ -45847,7 +45847,7 @@ The cache abstraction allows not just population of a cache store but also evict
4584745847
This process is useful for removing stale or unused data from the cache. Opposed to
4584845848
`@Cacheable`, annotation `@CacheEvict` demarcates methods that perform cache
4584945849
__eviction__, that is methods that act as triggers for removing data from the cache.
45850-
Just like its sibling, `@CacheEvict` requires one to specify one (or multiple) caches
45850+
Just like its sibling, `@CacheEvict` requires specifying one (or multiple) caches
4585145851
that are affected by the action, allows a key or a condition to be specified but in
4585245852
addition, features an extra parameter `allEntries` which indicates whether a cache-wide
4585345853
eviction needs to be performed rather then just an entry one (based on the key):
@@ -45876,7 +45876,7 @@ to the method outcome.
4587645876

4587745877
It is important to note that void methods can be used with `@CacheEvict` - as the
4587845878
methods act as triggers, the return values are ignored (as they don't interact with the
45879-
cache) - this is not the case with `@Cacheable` which adds/update data into the cache
45879+
cache) - this is not the case with `@Cacheable` which adds/updates data into the cache
4588045880
and thus requires a result.
4588145881

4588245882

@@ -45887,7 +45887,7 @@ and thus requires a result.
4588745887
There are cases when multiple annotations of the same type, such as `@CacheEvict` or
4588845888
`@CachePut` need to be specified, for example because the condition or the key
4588945889
expression is different between different caches. Unfortunately Java does not support
45890-
such declarations however there is a workaround - using a __enclosing__ annotation, in
45890+
such declarations however there is a workaround - using an __enclosing__ annotation, in
4589145891
this case, `@Caching`. `@Caching` allows multiple nested `@Cacheable`, `@CachePut` and
4589245892
`@CacheEvict` to be used on the same method:
4589345893

@@ -45903,7 +45903,7 @@ this case, `@Caching`. `@Caching` allows multiple nested `@Cacheable`, `@CachePu
4590345903
[[cache-annotation-enable]]
4590445904
==== Enable caching annotations
4590545905
It is important to note that even though declaring the cache annotations does not
45906-
automatically triggers their actions - like many things in Spring, the feature has to be
45906+
automatically trigger their actions - like many things in Spring, the feature has to be
4590745907
declaratively enabled (which means if you ever suspect caching is to blame, you can
4590845908
disable it by removing only one configuration line rather then all the annotations in
4590945909
your code).
@@ -46207,7 +46207,7 @@ reference documentation].
4620746207
==== Dealing with caches without a backing store
4620846208
Sometimes when switching environments or doing testing, one might have cache
4620946209
declarations without an actual backing cache configured. As this is an invalid
46210-
configuration, at runtime an exception will be through since the caching infrastructure
46210+
configuration, at runtime an exception will be thrown since the caching infrastructure
4621146211
is unable to find a suitable store. In situations like this, rather then removing the
4621246212
cache declarations (which can prove tedious), one can wire in a simple, dummy cache that
4621346213
performs no caching - that is, forces the cached methods to be executed every time:

0 commit comments

Comments
 (0)