module Firebolt::Cache

Public Instance Methods

delete(key_suffix, options = nil) click to toggle source
# File lib/firebolt/cache.rb, line 5
def delete(key_suffix, options = nil)
  salted_key = cache_key_with_salt(key_suffix, salt)
  return nil if salted_key.nil?

  ::Firebolt.config.cache.delete(salted_key, options)
end
fetch(key_suffix, options = nil, &block) click to toggle source
# File lib/firebolt/cache.rb, line 12
def fetch(key_suffix, options = nil, &block)
  salted_key = cache_key_with_salt(key_suffix, salt)
  return nil if salted_key.nil?

  ::Firebolt.config.cache.fetch(salted_key, options, &block)
end
read(key_suffix, options = nil) click to toggle source
# File lib/firebolt/cache.rb, line 19
def read(key_suffix, options = nil)
  salted_key = cache_key_with_salt(key_suffix, salt)
  return nil if salted_key.nil?

  ::Firebolt.config.cache.read(salted_key, options)
end
reset_salt!(new_salt) click to toggle source
# File lib/firebolt/cache.rb, line 26
def reset_salt!(new_salt)
  ::Firebolt.config.cache.write(salt_key, new_salt)
end
salt() click to toggle source
# File lib/firebolt/cache.rb, line 30
def salt
  ::Firebolt.config.cache.read(salt_key)
end
write(key_suffix, value, options = {}) click to toggle source
# File lib/firebolt/cache.rb, line 34
def write(key_suffix, value, options = {})
  salted_key = cache_key_with_salt(key_suffix, salt)
  return nil if salted_key.nil?

  options.merge!(:expires_in => ::Firebolt.config.warming_frequency + 1.hour)
  ::Firebolt.config.cache.write(salted_key, value, options)
end