Sha256: 2464e09adea03672177da57d13b2ad2b85c1baddefb79f3f1f712795ee34f72d
Contents?: true
Size: 592 Bytes
Versions: 1
Compression:
Stored size: 592 Bytes
Contents
require 'undo/serializer/null' module Undo module Storage class Redis def initialize(redis, options = {}) @redis = redis @serializer = options[:serializer] || Undo::Serializer::Null.new end def put(uuid, object) redis.set uuid, serialize(object) end def fetch(uuid) deserialize redis.get(uuid) end private attr_reader :redis, :serializer def serialize(object) serializer.to_json object end def deserialize(data) serializer.from_json data end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
undo-storage-redis-0.0.1 | lib/undo/storage/redis.rb |