diff --git a/src/reference/docbook/cache.xml b/src/reference/docbook/cache.xml index 01fa2d5a875f..43a092875a7b 100644 --- a/src/reference/docbook/cache.xml +++ b/src/reference/docbook/cache.xml @@ -113,7 +113,7 @@ public Book findBook(ISBN isbn) {...}]]> obvious when the target method has multiple arguments out of which only some are suitable for caching (while the rest are used only by the method logic). For example: +public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]> At first glance, while the two boolean arguments influence the way the book is found, they are no use for the cache. Further more what if only one of the two is important while the other is not? @@ -128,7 +128,7 @@ public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed]]> -@Cacheable(value="books", key="#isbn" +@Cacheable(value="books", key="#isbn") public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed) @@ -298,7 +298,6 @@ public Book importBooks(String deposit, Date date)]]> @Configuration @EnableCaching public class AppConfig { - } Alternatively for XML configuration use the cache:annotation-driven element: @@ -506,8 +505,8 @@ public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]>< -... -// cache manager definition omitted + + ]]> @@ -530,8 +529,8 @@ public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]>< Configuring the cache storage Out of the box, the cache abstraction provides integration with two storages - one on top of the JDK ConcurrentMap and one - for ehcache library. To use them, one needs to simply declare an appropriate CacheManager - an entity that controls and manages - Caches and can be used to retrieve these for storage. + for EhCache library. To use them, one needs to simply declare an appropriate CacheManager - an entity that controls and + manages Caches and can be used to retrieve these for storage.
JDK <interfacename>ConcurrentMap</interfacename>-based <interfacename>Cache</interfacename> @@ -542,15 +541,15 @@ public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]>< - - - - + + + + ]]> - The snippet above uses the SimpleCacheManager to create a CacheManager for the two, nested Concurrent - Cache implementations named default and books. + The snippet above uses the SimpleCacheManager to create a CacheManager for the two nested ConcurrentMapCache + instances named default and books. Note that the names are configured directly for each cache. As the cache is created by the application, it is bound to its lifecycle, making it suitable for basic use cases, tests or simple applications. The cache scales well and is very fast @@ -588,10 +587,12 @@ public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]>< one can wire in a simple, dummy cache that performs no caching - that is, forces the cached methods to be executed every time: - - - - + + + + + + ]]>