redis2-session-store 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/redis-session-store.rb +5 -6
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/redis-session-store.rb
CHANGED
@@ -28,7 +28,7 @@ class RedisSessionStore < ActionController::Session::AbstractStore
|
|
28
28
|
:key_prefix => ""
|
29
29
|
}.update(options)
|
30
30
|
|
31
|
-
@
|
31
|
+
@redis = Redis.new(@default_options)
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
@@ -39,7 +39,7 @@ class RedisSessionStore < ActionController::Session::AbstractStore
|
|
39
39
|
def get_session(env, sid)
|
40
40
|
sid ||= generate_sid
|
41
41
|
begin
|
42
|
-
data = @
|
42
|
+
data = @redis.get prefixed(sid)
|
43
43
|
session = data.nil? ? {} : Marshal.load(data)
|
44
44
|
rescue Errno::ECONNREFUSED
|
45
45
|
session = {}
|
@@ -51,10 +51,9 @@ class RedisSessionStore < ActionController::Session::AbstractStore
|
|
51
51
|
options = env['rack.session.options']
|
52
52
|
expiry = options[:expire_after] || nil
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
54
|
+
# redis.multi only works in redis2.
|
55
|
+
@redis.set(prefixed(sid), Marshal.dump(session_data))
|
56
|
+
@redis.expire(prefixed(sid), expiry) if expiry
|
58
57
|
|
59
58
|
return true
|
60
59
|
rescue Errno::ECONNREFUSED
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis2-session-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Nichols
|