Class: Rack::Session::Redis::MarshalledRedis
- Inherits:
-
Redis
- Object
- Redis
- Rack::Session::Redis::MarshalledRedis
- Defined in:
- lib/rack/session/redis.rb
Instance Method Summary collapse
- #del(key) ⇒ Object
- #get(key) ⇒ Object
-
#initialize(options = {}) ⇒ MarshalledRedis
constructor
A new instance of MarshalledRedis.
- #set(key, value) ⇒ Object
- #setex(key, time, value) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ MarshalledRedis
Returns a new instance of MarshalledRedis.
15 16 17 18 19 |
# File 'lib/rack/session/redis.rb', line 15 def initialize ={} @namespace = .delete(:namespace) super end |
Instance Method Details
#del(key) ⇒ Object
31 32 33 |
# File 'lib/rack/session/redis.rb', line 31 def del key super namespace(key) end |
#get(key) ⇒ Object
21 22 23 24 |
# File 'lib/rack/session/redis.rb', line 21 def get key raw = super namespace(key) Marshal.load raw if raw end |
#set(key, value) ⇒ Object
26 27 28 29 |
# File 'lib/rack/session/redis.rb', line 26 def set key, value raw = Marshal.dump value super namespace(key), raw end |
#setex(key, time, value) ⇒ Object
35 36 37 38 |
# File 'lib/rack/session/redis.rb', line 35 def setex key, time, value raw = Marshal.dump value super namespace(key), time, raw end |