Learn how Scrivito CMS can help you deliver amazing digital experiences
See Scrivito CMS in action

Using a Second-Level Data Cache

Using a Second-Level Data Cache

Scrivito lets you add a custom 2nd-level cache to its cache store chain using Scrivito::Configuration.second_level_cache. This is useful when deploying to Heroku, for example, because the file system offered by this service is volatile.

By default, no second-level cache is configured. If it is set, Scrivito stores its cache both in the file system cache and the second-level cache. Also, Scrivito will search the second-level cache if searching the file system cache doesn't return any results. If the second-level cache returns results, they are stored in the file system cache. Here's a configuration example:

# Use Memcached as the 2nd-level cache (https://rubygems.org/gems/dalli): require 'active_support/cache/dalli_store' Scrivito.configure do |config| config.second_level_cache = ActiveSupport::Cache::DalliStore.new( 'server-downstairs.localnetwork:1234',   'server-downstairs.localnetwork:4321', username: 'root', password: 'secret' ) end