rack-redis-session-store 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack-redis-session-store.rb +13 -22
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b92694592164facffa121a611d0dc3d91ec136
|
4
|
+
data.tar.gz: 4f26f80bba4017629352c698d6c2b5099993e434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1156d282e92feb912eb5a2e549bb2dbbb1dfb1a7e4bfceb18e50f6532831ef0b5ebc54e3e02f0840fbe8ee361c47d911499584db41962ae2a649d5c39bcadaf1
|
7
|
+
data.tar.gz: b88e3ec0c62d51653c700d422b332f89e22d0ed9ad1d9358a955ebe445e8291801becde4f0d918b2c1964d40ac1df90997769434bdeb2e57ecb8b6d5ec893e4c
|
@@ -24,41 +24,32 @@ module ActionDispatch
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def get_session(env, sid)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
options = env['rack.session.options']
|
31
|
-
session_string = redis.get(sid)
|
32
|
-
if session_string
|
33
|
-
session = JSON.parse(session_string)
|
34
|
-
end
|
27
|
+
@redis.with do |redis|
|
28
|
+
unless sid and session = JSON.parse(redis.get(sid))
|
29
|
+
sid, session = generate_sid, {}
|
35
30
|
end
|
36
|
-
|
37
|
-
sid = generate_sid
|
31
|
+
[sid, session]
|
38
32
|
end
|
39
|
-
[sid, session]
|
40
33
|
end
|
41
34
|
|
42
35
|
def set_session(env, session_id, new_session, options)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
expiry = options[:expire_after]
|
37
|
+
expiry = expiry.nil? ? 0 : expiry + 1
|
38
|
+
|
39
|
+
@redis.with do |redis|
|
40
|
+
json = Jbuilder.encode do |json|
|
41
|
+
json.(new_session, *new_session.keys)
|
49
42
|
end
|
43
|
+
redis.setex session_id, expiry,json
|
44
|
+
session_id
|
50
45
|
end
|
51
|
-
#For some reason, rack doesn't set new session_id to options[:id]
|
52
|
-
options[:id] = session_id
|
53
|
-
return session_id
|
54
46
|
end
|
55
47
|
|
56
48
|
def destroy_session(env, session_id, options)
|
57
|
-
puts('Destroy session')
|
58
49
|
@redis.with do |redis|
|
59
50
|
redis.del(session_id)
|
51
|
+
generate_sid unless options[:drop]
|
60
52
|
end
|
61
|
-
generate_sid unless options[:drop]
|
62
53
|
end
|
63
54
|
end
|
64
55
|
end
|
data/lib/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = '2.0.
|
1
|
+
VERSION = '2.0.3'
|