From 7115ab8e276eeb9ad960cc562da9464f774bf46c Mon Sep 17 00:00:00 2001 From: Sergei Dudzin Date: Fri, 3 May 2024 15:27:49 +0200 Subject: [PATCH] Updated documentation --- .../commonGuide/configuration/WsCache.md | 27 +++++++++++-------- .../working/javaGuide/main/cache/JavaCache.md | 2 +- .../scalaGuide/main/cache/ScalaCache.md | 4 +-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/documentation/manual/working/commonGuide/configuration/WsCache.md b/documentation/manual/working/commonGuide/configuration/WsCache.md index 8d81931b363..61416bc3084 100644 --- a/documentation/manual/working/commonGuide/configuration/WsCache.md +++ b/documentation/manual/working/commonGuide/configuration/WsCache.md @@ -45,17 +45,22 @@ play.ws.cache.cacheManagerResource="ehcache-play-ws-cache.xml" and then adding a cache such as following into the `conf` directory: ```xml - - - - - + + + + java.lang.String + play.api.cache.ExpirableCacheValue + + 360 + + + 10000 + + + ``` > **NOTE**: `play.ws.cache.cacheManagerURI` is deprecated, use `play.ws.cache.cacheManagerResource` with a path on the classpath instead. diff --git a/documentation/manual/working/javaGuide/main/cache/JavaCache.md b/documentation/manual/working/javaGuide/main/cache/JavaCache.md index c55e5af14e5..5b5a4cf3e53 100644 --- a/documentation/manual/working/javaGuide/main/cache/JavaCache.md +++ b/documentation/manual/working/javaGuide/main/cache/JavaCache.md @@ -8,7 +8,7 @@ Caching data is a typical optimization in modern applications, and so Play provi For any data stored in the cache, a regeneration strategy needs to be put in place in case the data goes missing. This philosophy is one of the fundamentals behind Play, and is different from Java EE, where the session is expected to retain values throughout its lifetime. -Play provides a CacheApi implementation based on [Caffeine](https://github.com/ben-manes/caffeine/) and a legacy implementation based on [Ehcache 2.x](http://www.ehcache.org). For in-process caching Caffeine is typically the best choice. If you need distributed caching, there are third-party plugins for [memcached](https://github.com/mumoshu/play2-memcached) and [redis](https://github.com/KarelCemus/play-redis). +Play provides a CacheApi implementation based on [Caffeine](https://github.com/ben-manes/caffeine/) and a legacy implementation based on [Ehcache 3.x](http://www.ehcache.org). For in-process caching Caffeine is typically the best choice. If you need distributed caching, there are third-party plugins for [memcached](https://github.com/mumoshu/play2-memcached) and [redis](https://github.com/KarelCemus/play-redis). ## Importing the Cache API diff --git a/documentation/manual/working/scalaGuide/main/cache/ScalaCache.md b/documentation/manual/working/scalaGuide/main/cache/ScalaCache.md index 721f9c653f3..26ba33f1b76 100644 --- a/documentation/manual/working/scalaGuide/main/cache/ScalaCache.md +++ b/documentation/manual/working/scalaGuide/main/cache/ScalaCache.md @@ -8,7 +8,7 @@ Caching data is a typical optimization in modern applications, and so Play provi For any data stored in the cache, a regeneration strategy needs to be put in place in case the data goes missing. This philosophy is one of the fundamentals behind Play, and is different from Java EE, where the session is expected to retain values throughout its lifetime. -Play provides a CacheApi implementation based on [Caffeine](https://github.com/ben-manes/caffeine/) and a legacy implementation based on [Ehcache 2.x](http://www.ehcache.org). For in-process caching Caffeine is typically the best choice. If you need distributed caching, there are third-party plugins for [memcached](https://github.com/mumoshu/play2-memcached) and [redis](https://github.com/KarelCemus/play-redis). +Play provides a CacheApi implementation based on [Caffeine](https://github.com/ben-manes/caffeine/) and a legacy implementation based on [Ehcache 3.x](http://www.ehcache.org). For in-process caching Caffeine is typically the best choice. If you need distributed caching, there are third-party plugins for [memcached](https://github.com/mumoshu/play2-memcached) and [redis](https://github.com/KarelCemus/play-redis). ## Importing the Cache API @@ -121,7 +121,7 @@ By default, Play will try to create caches with names from `play.cache.bindCache ## Setting the execution context By default, Caffeine and EhCache store elements in memory. Therefore reads from and writes to the cache should be very fast, because there is hardly any blocking I/O. -However, depending on how a cache was configured (e.g. by using [EhCache's `DiskStore`](http://www.ehcache.org/generated/2.10.4/html/ehc-all/#page/Ehcache_Documentation_Set%2Fco-store_storage_tiers.html)), there might be blocking I/O which can become too costly, because even the async implementations will block threads in the default execution context. +However, depending on how a cache was configured (e.g. by using [EhCache's `DiskStore`](https://www.ehcache.org/documentation/3.10/tiering.html#disk-tier)), there might be blocking I/O which can become too costly, because even the async implementations will block threads in the default execution context. For such a case you can configure a different [Pekko dispatcher](https://pekko.apache.org/docs/pekko/1.0/dispatchers.html?language=scala#looking-up-a-dispatcher) and set it via `play.cache.dispatcher` so the cache plugin makes use of it: