redis_session_store 0.0.2 → 0.1
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.
- checksums.yaml +7 -0
- data/README.md +11 -0
- data/lib/redis_session_store.rb +10 -15
- metadata +20 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 558aa2fc893d80d5f7b3150be9fdf19ce9482614
|
4
|
+
data.tar.gz: ceb4c817c4458869c058e14e41f6112a034b9c26
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 070416e85386e74cfa967f166ae3cf654c809f2ed5b27966b959e79b4195f13d49f957bf69dc8433e866b1bd3804040ee7118ce60e2ae56567698083c8da6c52
|
7
|
+
data.tar.gz: 7995d628c38fb4bc42cd1cf46d70071f3cf79ee0b8847058e166f848d6e30c4306c7ec33d2d2ca53ce986e7ddf587ebeae8fbbe492dd8482bafcf0c071ef33b1
|
data/README.md
ADDED
data/lib/redis_session_store.rb
CHANGED
@@ -15,6 +15,7 @@ class ActionDispatch::Session::RedisSessionStore < ActionDispatch::Session::Abst
|
|
15
15
|
def initialize(app, options = {})
|
16
16
|
# Support old :expires option
|
17
17
|
options[:expire_after] ||= options[:expires]
|
18
|
+
options[:key_prefix] ||= options[:key]
|
18
19
|
|
19
20
|
super
|
20
21
|
|
@@ -38,33 +39,29 @@ class ActionDispatch::Session::RedisSessionStore < ActionDispatch::Session::Abst
|
|
38
39
|
sid ||= generate_sid
|
39
40
|
begin
|
40
41
|
data = @pool.get prefixed(sid)
|
41
|
-
|
42
|
+
|
42
43
|
session = data.nil? ? {} : Marshal.load(Base64.decode64(data))
|
43
|
-
# session = data.nil? ? {} : JSON.parse(data)
|
44
44
|
rescue Errno::ECONNREFUSED
|
45
45
|
session = {}
|
46
46
|
end
|
47
47
|
[sid, session]
|
48
48
|
end
|
49
49
|
|
50
|
-
def destroy(env)
|
51
|
-
if sid = current_session_id(env)
|
52
|
-
@pool.del(sid)
|
53
|
-
end
|
54
|
-
rescue Errno::ECONNREFUSED
|
55
|
-
false
|
56
|
-
end
|
50
|
+
def destroy(env)
|
51
|
+
if sid = current_session_id(env)
|
52
|
+
@pool.del(sid)
|
53
|
+
end
|
54
|
+
rescue Errno::ECONNREFUSED
|
55
|
+
false
|
56
|
+
end
|
57
57
|
|
58
|
-
def set_session(env, sid, session_data)
|
59
|
-
options = env['rack.session.options']
|
58
|
+
def set_session(env, sid, session_data, options)
|
60
59
|
expiry = options[:expire_after] || nil
|
61
|
-
# @pool.set(sid, session_data, options)
|
62
60
|
|
63
61
|
@pool.pipelined do
|
64
62
|
b64_data = Base64.encode64 Marshal.dump(session_data)
|
65
63
|
b64_data = b64_data[0...-1]
|
66
64
|
@pool.set(prefixed(sid), b64_data)
|
67
|
-
# @pool.set(prefixed(sid), JSON.unparse(session_data))
|
68
65
|
@pool.expire(prefixed(sid), expiry.to_i) if expiry && expiry.to_i > 0
|
69
66
|
end
|
70
67
|
|
@@ -74,5 +71,3 @@ class ActionDispatch::Session::RedisSessionStore < ActionDispatch::Session::Abst
|
|
74
71
|
end
|
75
72
|
|
76
73
|
end
|
77
|
-
|
78
|
-
|
metadata
CHANGED
@@ -1,56 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_session_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: '0.1'
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jaehwa Han
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-08-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: redis
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
|
-
type: :
|
20
|
+
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Rails 4.0 compatible session store using redis
|
26
28
|
email: drh@wafflestudio.com
|
27
29
|
executables: []
|
28
30
|
extensions: []
|
29
31
|
extra_rdoc_files: []
|
30
32
|
files:
|
31
33
|
- lib/redis_session_store.rb
|
32
|
-
|
34
|
+
- README.md
|
35
|
+
homepage: https://github.com/drunkhacker/redis-session-store
|
33
36
|
licenses: []
|
37
|
+
metadata: {}
|
34
38
|
post_install_message:
|
35
39
|
rdoc_options: []
|
36
40
|
require_paths:
|
37
41
|
- lib
|
38
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
43
|
requirements:
|
41
|
-
- -
|
44
|
+
- - '>='
|
42
45
|
- !ruby/object:Gem::Version
|
43
46
|
version: '0'
|
44
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
48
|
requirements:
|
47
|
-
- -
|
49
|
+
- - '>='
|
48
50
|
- !ruby/object:Gem::Version
|
49
51
|
version: '0'
|
50
52
|
requirements: []
|
51
|
-
rubyforge_project:
|
52
|
-
rubygems_version:
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 2.0.3
|
53
55
|
signing_key:
|
54
|
-
specification_version:
|
55
|
-
summary:
|
56
|
+
specification_version: 4
|
57
|
+
summary: Rails 4.0 compatible session store using redis
|
56
58
|
test_files: []
|