lib/scrivito/configuration.rb in scrivito_sdk-0.40.0 vs lib/scrivito/configuration.rb in scrivito_sdk-0.41.0.rc1
- old
+ new
@@ -79,18 +79,53 @@
# end
def find_user(&find_user_proc)
self.find_user_proc = find_user_proc
end
- # The +Scrivito+ makes heavy use of filesystem caching.
- # Use this method to configure the directory that should be used to store cached data.
- # By default, +RAILS_ROOT/tmp/scrivito_cache+ will be used.
+ #
+ # Set the path for the filesystem cache.
+ #
+ # +Scrivito+ makes heavy use of filesystem caching. Use this method to configure the directory
+ # that should be used to store cached data. By default, +RAILS_ROOT/tmp/scrivito_cache+ will
+ # be used.
+ #
+ # @api public
+ #
# @param path [String] Path to directory that should be used to store cached data.
+ #
# @example Configure +Scrivito+ to store its cache under +/tmp/my_cache+.
- # Scrivito::Configuration.cache_path = '/tmp/my_cache'
- # @api public
+ #
+ # Scrivito.configure do |config|
+ # config.cache_path = '/tmp/my_cache'
+ # end
+ #
def cache_path=(path)
- CmsCacheStorage.backend_cache = ActiveSupport::Cache::FileStore.new(path)
+ CmsDataCache.cache_path = path
+ end
+
+ #
+ # Sets the second level cache.
+ #
+ # If it is set, then +Scrivito+ will additionaly store its cache in both: the filesystem cache
+ # and the second level cache. Also +Scrivito+ will search in the second level cache if
+ # searching in the filesystem cache returns no results. If the second level cache returns
+ # results, then the results will be store in the filesystem cache.
+ #
+ # By default it is not set.
+ #
+ # @api public
+ #
+ # @param cache_store [ActiveSupport::Cache::Store] cache store to be used as the second level
+ # cache
+ #
+ # @example Use Memcached as the second level cache (https://rubygems.org/gems/dalli)
+ #
+ # Scrivito.configure do |config|
+ # config.second_level_cache = ActiveSupport::Cache::DalliStore.new("localhost", "server-downstairs.localnetwork:8229")
+ # end
+ #
+ def second_level_cache=(cache_store)
+ CmsDataCache.second_level_cache = cache_store
end
#
# Sets the tenant name.
# This configuration key _must_ be provided.