Skip to content

Commit

Permalink
Merge pull request #121 from avo-hq/add/cache_store_config
Browse files Browse the repository at this point in the history
add: custom cache store
  • Loading branch information
Paul-Bob authored Oct 18, 2023
2 parents 1aa0f63 + a572d1c commit dee90e7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
25 changes: 23 additions & 2 deletions docs/2.0/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions docs/2.0/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit dee90e7

Please sign in to comment.