module Cachext

Constants

MissingRecord
VERSION

Public Class Methods

Key(raw_key) click to toggle source
# File lib/cachext.rb, line 13
def self.Key raw_key
  raw_key.is_a?(Key) ? raw_key : Key.new(raw_key)
end
clear(raw_key) click to toggle source
# File lib/cachext.rb, line 21
def self.clear raw_key
  Key(raw_key).clear
end
client() click to toggle source
# File lib/cachext.rb, line 29
def self.client
  @client ||= Client.new config
end
config() click to toggle source
# File lib/cachext.rb, line 37
def self.config
  @config ||= Configuration.new
end
config=(new_config) click to toggle source
# File lib/cachext.rb, line 33
def self.config=(new_config)
  @config = new_config
end
configure(&block) click to toggle source
# File lib/cachext.rb, line 51
def self.configure &block
  @config_block = block
  @config = Configuration.setup(&block)
  @client = Client.new @config
end
fetch(raw_key, overrides = {}) click to toggle source
# File lib/cachext.rb, line 17
def self.fetch raw_key, overrides = {}, &block
  client.fetch Key(raw_key), overrides, &block
end
flush() click to toggle source
# File lib/cachext.rb, line 41
def self.flush
  config.cache.clear
  keys = config.redis.keys("cachext:*")
  config.redis.del(*keys) if keys.length > 0
end
forked!() click to toggle source
# File lib/cachext.rb, line 57
def self.forked!
  configure(&@config_block)
end
locked?(raw_key) click to toggle source
# File lib/cachext.rb, line 25
def self.locked? raw_key
  Key(raw_key).locked?
end
multi(klass, ids, options = {}) click to toggle source
# File lib/cachext.rb, line 47
def self.multi klass, ids, options = {}, &block
  Multi.new(config, klass, options).fetch ids, &block
end