Class: Rack::Session::Redis::MarshalledRedis

Inherits:
Redis
  • Object
show all
Defined in:
lib/rack/session/redis.rb

Instance Method Summary collapse

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 options={}
  @namespace = options.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