Sha256: 74293f4b1fcd3502f579691dd5b3638e5a5aea4e465461a4fb9bd8b4900cf82f
Contents?: true
Size: 871 Bytes
Versions: 5
Compression:
Stored size: 871 Bytes
Contents
# frozen_string_literal: true require "active_support/all" require "second_level_cache/config" require "second_level_cache/record_marshal" require "second_level_cache/record_relation" require "second_level_cache/active_record" module SecondLevelCache def self.configure block_given? ? yield(Config) : Config end def self.without_second_level_cache old_cache_enabled = SecondLevelCache.cache_enabled? SecondLevelCache.cache_enabled = false yield ensure SecondLevelCache.cache_enabled = old_cache_enabled end def self.cache_enabled? cache_enabled = Thread.current[:slc_cache_enabled] cache_enabled.nil? ? true : cache_enabled end def self.cache_enabled=(cache_enabled) Thread.current[:slc_cache_enabled] = cache_enabled end class << self delegate :logger, :cache_store, :cache_key_prefix, to: Config end end
Version data entries
5 entries across 5 versions & 1 rubygems