From c77bb64320d1ac77da59d4d099a88f9a309b6728 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Wed, 18 Oct 2023 12:51:31 +0300 Subject: [PATCH 1/2] add: custom cache store --- docs/2.0/cache.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/2.0/cache.md b/docs/2.0/cache.md index 1c3c0c32..dba55cfc 100644 --- a/docs/2.0/cache.md +++ b/docs/2.0/cache.md @@ -8,16 +8,37 @@ The cache system dynamically selects the appropriate cache store based on the ap ### Production -In production, it uses the existing cache store when it's one of the following: `ActiveSupport::Cache::MemCacheStore`, `ActiveSupport::Cache::RedisCacheStore` or `SolidCache::Store`. Otherwise, it defaults to `:file_store` with a cache path of `tmp/cache`. +In production, if the existing cache store is one of the following: `ActiveSupport::Cache::MemoryStore` or `ActiveSupport::Cache::NullStore` it will use the default `:file_store` with a cache path of `tmp/cache`. Otherwise, the existing cache store `Rails.cache` will be used. ### Test -In testing, it directly uses the Rails cache store. +In testing, it directly uses the `Rails.cache` store. ### Development and other environments In all other environments the `:memory_store` is used. +### Custom selection + +There is the possibility to force the usage of a custom cache store into Avo. + +```ruby +# config/initializers/avo.rb +config.cache_store = -> { + ActiveSupport::Cache.lookup_store(:solid_cache_store) +} + +# or + +config.cache_store = ActiveSupport::Cache.lookup_store(:solid_cache_store) +``` + +`cache_store` configuration option is expecting a cache store object, the lambda syntax can be useful if different stores are desired on different environments. + +:::warning MemoryStore in production +Our computed system do not use MemoryStore in production because it will not be shared between multiple processes (when using Puma). +::: + ## Solid Cache Avo seamlessly integrates with [Solid Cache](https://github.com/rails/solid_cache). To setup Solid Cache follow these essential steps From a572d1c126a95fbc0d740e4bc3f3844dd3a236af Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Wed, 18 Oct 2023 13:13:06 +0300 Subject: [PATCH 2/2] upgrade guide --- docs/2.0/upgrade.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/2.0/upgrade.md b/docs/2.0/upgrade.md index e4e3384d..62973207 100644 --- a/docs/2.0/upgrade.md +++ b/docs/2.0/upgrade.md @@ -3,6 +3,13 @@ We generally push changes behind the scenes, so you don't have to update your code, but sometimes the public API is updated too. Follow these guides to make sure your configuration files are up to date. +## Upgrade from 2.42.1 to 2.42.2 +Since there are many available cache stores and we were allowing only few we changed the way of computing the cache store to be used by Avo. + +One of our concerns was to maintain the status quo, but if you notice any caching issues there is a new configurable option [`config.cache_store`](cache#custom-selection) that allows you to tell Avo what `cache_store` to use. + +Check [cache page](cache) for more details. + ## Upgrade from 2.40 to 2.41 ### Badge field `secondary` option renamed to `neutral`