Sha256: 52df2436a81e709d03617592cda99e9493ca358c29897307e4adac081ac25047
Contents?: true
Size: 1.48 KB
Versions: 7
Compression:
Stored size: 1.48 KB
Contents
module Scrivito # This module manages storage of different kind of cache data. module CmsCacheStorage VERSION = 'v2'.freeze class << self attr_writer :cache def cache @cache ||= begin Cache.new(fallback_backend: backend_cache, cache_prefix: VERSION) end end def backend_cache=(new_cache) @backend_cache = new_cache @cache = nil end def backend_cache @backend_cache || ActiveSupport::Cache::FileStore.new(Rails.root + 'tmp/scrivito_cache') end def read_workspace_data(workspace_id) cache.read("workspace/#{workspace_id}") end def write_workspace_data(workspace_id, workspace_data) cache.write("workspace/#{workspace_id}", workspace_data) end def read_content_state(content_state_id) cache.read("content/#{content_state_id}") end def write_content_state(content_state_id, content_state) cache.write("content/#{content_state_id}", content_state) end def read_obj_data(content_state_id, index, key) cache.read("content/#{content_state_id}/obj/#{index}/#{key}") end def write_obj_data(content_state_id, index, key, data) cache.write("content/#{content_state_id}/obj/#{index}/#{key}", data) end def read_obj_classes_data(content_state_id) cache.read("content/#{content_state_id}/obj_classes") end def write_obj_classes_data(content_state_id, data) cache.write("content/#{content_state_id}/obj_classes", data) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems