Class: Undo::Storage::Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/undo/storage/redis.rb,
lib/undo/storage/redis/gemspec.rb

Defined Under Namespace

Modules: Gemspec

Instance Method Summary collapse

Constructor Details

#initialize(redis, options = {}) ⇒ Redis

Returns a new instance of Redis.



6
7
8
9
# File 'lib/undo/storage/redis.rb', line 6

def initialize(redis, options = {})
  @redis = redis
  @serializer = options[:serializer] || Undo::Serializer::Null.new
end

Instance Method Details

#fetch(uuid) ⇒ Object



15
16
17
# File 'lib/undo/storage/redis.rb', line 15

def fetch(uuid)
  deserialize redis.get(uuid)
end

#put(uuid, object) ⇒ Object



11
12
13
# File 'lib/undo/storage/redis.rb', line 11

def put(uuid, object)
  redis.set uuid, serialize(object)
end