Sha256: b0ee5086297cd67b9b454d844928e6d54a127237ede09eec53f411ac897c07b3

Contents?: true

Size: 406 Bytes

Versions: 9

Compression:

Stored size: 406 Bytes

Contents

require 'cachy/wrapper'
require 'yaml'

class Cachy::RedisWrapper < Cachy::Wrapper
  def read(key)
    result = @wrapped[key]
    return if result.nil?
    YAML.load(result)
  end

  def write(key, value, options={})
    result = @wrapped.set(key, value.to_yaml)
    @wrapped.expire(key, options[:expires_in].to_i) if options[:expires_in]
    result
  end

  def delete(key)
    @wrapped.del(key)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cachy-0.4.1 lib/cachy/redis_wrapper.rb
cachy-0.4.0 lib/cachy/redis_wrapper.rb
cachy-0.3.1 lib/cachy/redis_wrapper.rb
cachy-0.3.0 lib/cachy/redis_wrapper.rb
cachy-0.2.1 lib/cachy/redis_wrapper.rb
cachy-0.2.0 lib/cachy/redis_wrapper.rb
cachy-0.1.7 lib/cachy/redis_wrapper.rb
cachy-0.1.6 lib/cachy/redis_wrapper.rb
cachy-0.1.5 lib/cachy/redis_wrapper.rb