class Geode::RedisStore
A store implemented using Redis.
Public Class Methods
new(name, connection = nil)
click to toggle source
Connect to a store held in Redis. @param name [Symbol, String] The name of the store @param connection [Hash, String] Connection parameters passed to `Redis.new`.
Defaults to empty hash
Calls superclass method
Geode::Store::new
# File lib/geode/redis.rb, line 12 def initialize(name, connection = nil) super connection ||= {} @redis = Redis.new(connection) end
Public Instance Methods
open() { |table).tap do set name, dump| ... }
click to toggle source
# File lib/geode/redis.rb, line 18 def open table = if @redis.exists? @name Marshal.load(@redis.get @name) else {} end (yield table).tap do @redis.set @name, Marshal.dump(table) end