Sha256: f617319bc47064f4fd9307d8c8e446e9b389de2c68d9ea753e5f50651123c8b9
Contents?: true
Size: 721 Bytes
Versions: 13
Compression:
Stored size: 721 Bytes
Contents
begin require "redis" rescue LoadError puts "You need the redis gem to use the Redis store" exit end module Moneta module Adapters class Redis include Defaults def initialize(options = {}) @cache = ::Redis.new(options) end def key?(key, *) !@cache[key_for(key)].nil? end def [](key) deserialize(@cache.get(key_for(key))) end def delete(key, *) string_key = key_for(key) value = self[key] @cache.del(string_key) if value value end def store(key, value, *) @cache.set(key_for(key), serialize(value)) end def clear(*) @cache.flushdb end end end end
Version data entries
13 entries across 13 versions & 3 rubygems