Sha256: 355f7cc60ce1ca11d0ab85769716c34f250db1f87b8380490c3cd20a4aa7058c
Contents?: true
Size: 761 Bytes
Versions: 16
Compression:
Stored size: 761 Bytes
Contents
begin require "rufus/tokyo" rescue LoadError puts "You need the rufus gem to use the Rufus moneta store" exit end module Moneta class BasicRufus < ::Rufus::Tokyo::Cabinet include Defaults def initialize(options = {}) file = options[:file] super("#{file}.tch") end def key?(key) !!self[key] end def [](key) if val = super Marshal.load(val.unpack("m")[0]) end end def []=(key, value) super(key, [Marshal.dump(value)].pack("m")) end end class Rufus < BasicRufus include Expires def initialize(options = {}) file = options[:file] @expiration = BasicRufus.new(:file => "#{file}_expires") super end end end
Version data entries
16 entries across 16 versions & 9 rubygems