Sha256: d0d448edfff6d67f6bf08613602d0fa11edfcab8eb6e862acf20df99af7d1700
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 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" require "second_level_cache/log_subscriber" 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? if self.cache_store.is_a?(ActiveSupport::Cache::NullStore) return false end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
second_level_cache-2.7.1 | lib/second_level_cache.rb |