redis-session-store 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +1 -1
- data/.travis.yml +2 -2
- data/AUTHORS.md +3 -0
- data/CHANGELOG.md +10 -0
- data/README.md +4 -0
- data/lib/redis-session-store.rb +12 -11
- data/redis-session-store.gemspec +3 -3
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 197d2120a9c333b43c5c563a89ed0fcc96a6444918d0aa49207e3d74cc1c0fe3
|
4
|
+
data.tar.gz: 6946c195bdb70317a7e2e06c84643401a4e8b520dde2191c48c97e7399a39e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c830641d881e1ebcc7d472f98ca55e9ded617a869e7a5de87a7bd96c09cf23d5ef9244d8978aa7fe8747ba9179bc5e575a9914d2aafb2248b988d79b4e18a9c2
|
7
|
+
data.tar.gz: 086ff62e30cdb9b08b9845f5f9581ad20a05e38aadb868b1dc4ee08d07402ac6571936142c9f775e8c4ed38bdaa6825b9cda5ee7155444fe903e5af907fe70b8
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
data/.travis.yml
CHANGED
data/AUTHORS.md
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,16 @@
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [0.10.0] - 2018-04-14
|
8
|
+
### Changed
|
9
|
+
- JRuby to jruby-9.1.15.0
|
10
|
+
- Redis to '>= 3', '< 5'
|
11
|
+
- Actionpack to '>= 3', '< 6'
|
12
|
+
- Rake to 12
|
13
|
+
|
14
|
+
### Added
|
15
|
+
- with_indifferent_access if defined ActiveSupport
|
16
|
+
|
7
17
|
## [0.9.2] - 2017-10-31
|
8
18
|
### Changed
|
9
19
|
- Actionpack to 5.1
|
data/README.md
CHANGED
@@ -99,6 +99,10 @@ My::Application.config.session_store :redis_session_store, {
|
|
99
99
|
|
100
100
|
**Note** The session will *always* be destroyed when it cannot be loaded.
|
101
101
|
|
102
|
+
### Other notes
|
103
|
+
|
104
|
+
It returns with_indifferent_access if ActiveSupport is defined
|
105
|
+
|
102
106
|
## Rails 2 Compatibility
|
103
107
|
|
104
108
|
This gem is currently only compatible with Rails 3+. If you need
|
data/lib/redis-session-store.rb
CHANGED
@@ -3,7 +3,7 @@ require 'redis'
|
|
3
3
|
# Redis session storage for Rails, and for Rails only. Derived from
|
4
4
|
# the MemCacheStore code, simply dropping in Redis instead.
|
5
5
|
class RedisSessionStore < ActionDispatch::Session::AbstractStore
|
6
|
-
VERSION = '0.
|
6
|
+
VERSION = '0.10.0'.freeze
|
7
7
|
# Rails 3.1 and beyond defines the constant elsewhere
|
8
8
|
unless defined?(ENV_SESSION_OPTIONS_KEY)
|
9
9
|
ENV_SESSION_OPTIONS_KEY = if Rack.release.split('.').first.to_i > 1
|
@@ -13,6 +13,7 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
USE_INDIFFERENT_ACCESS = defined?(ActiveSupport).freeze
|
16
17
|
# ==== Options
|
17
18
|
# * +:key+ - Same as with the other cookie stores, key name
|
18
19
|
# * +:redis+ - A hash with redis-specific options
|
@@ -86,16 +87,15 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
|
|
86
87
|
"#{default_options[:key_prefix]}#{sid}"
|
87
88
|
end
|
88
89
|
|
89
|
-
def
|
90
|
-
|
91
|
-
|
92
|
-
session = {}
|
93
|
-
end
|
90
|
+
def session_default_values
|
91
|
+
[generate_sid, USE_INDIFFERENT_ACCESS ? {}.with_indifferent_access : {}]
|
92
|
+
end
|
94
93
|
|
95
|
-
|
94
|
+
def get_session(env, sid)
|
95
|
+
sid && (session = load_session_from_redis(sid)) ? [sid, session] : session_default_values
|
96
96
|
rescue Errno::ECONNREFUSED, Redis::CannotConnectError => e
|
97
97
|
on_redis_down.call(e, env, sid) if on_redis_down
|
98
|
-
|
98
|
+
session_default_values
|
99
99
|
end
|
100
100
|
alias find_session get_session
|
101
101
|
|
@@ -111,7 +111,8 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def decode(data)
|
114
|
-
serializer.load(data)
|
114
|
+
session = serializer.load(data)
|
115
|
+
USE_INDIFFERENT_ACCESS ? session.with_indifferent_access : session
|
115
116
|
end
|
116
117
|
|
117
118
|
def set_session(env, sid, session_data, options = nil)
|
@@ -121,10 +122,10 @@ class RedisSessionStore < ActionDispatch::Session::AbstractStore
|
|
121
122
|
else
|
122
123
|
redis.set(prefixed(sid), encode(session_data))
|
123
124
|
end
|
124
|
-
|
125
|
+
sid
|
125
126
|
rescue Errno::ECONNREFUSED, Redis::CannotConnectError => e
|
126
127
|
on_redis_down.call(e, env, sid) if on_redis_down
|
127
|
-
|
128
|
+
false
|
128
129
|
end
|
129
130
|
alias write_session set_session
|
130
131
|
|
data/redis-session-store.gemspec
CHANGED
@@ -16,11 +16,11 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = File.read('lib/redis-session-store.rb')
|
17
17
|
.match(/^ VERSION = '(.*)'/)[1]
|
18
18
|
|
19
|
-
gem.add_runtime_dependency 'actionpack', '>= 3', '<
|
20
|
-
gem.add_runtime_dependency 'redis', '
|
19
|
+
gem.add_runtime_dependency 'actionpack', '>= 3', '< 6'
|
20
|
+
gem.add_runtime_dependency 'redis', '>= 3', '< 5'
|
21
21
|
|
22
22
|
gem.add_development_dependency 'fakeredis', '~> 0.5'
|
23
|
-
gem.add_development_dependency 'rake', '~>
|
23
|
+
gem.add_development_dependency 'rake', '~> 12'
|
24
24
|
gem.add_development_dependency 'rspec', '~> 3'
|
25
25
|
gem.add_development_dependency 'rubocop', '~> 0.41'
|
26
26
|
gem.add_development_dependency 'simplecov', '~> 0.11'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-session-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,21 +29,27 @@ dependencies:
|
|
29
29
|
version: '3'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: redis
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '3'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '5'
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
43
46
|
requirements:
|
44
|
-
- - "
|
47
|
+
- - ">="
|
45
48
|
- !ruby/object:Gem::Version
|
46
49
|
version: '3'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '5'
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: fakeredis
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +70,14 @@ dependencies:
|
|
64
70
|
requirements:
|
65
71
|
- - "~>"
|
66
72
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
73
|
+
version: '12'
|
68
74
|
type: :development
|
69
75
|
prerelease: false
|
70
76
|
version_requirements: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
78
|
- - "~>"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
80
|
+
version: '12'
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: rspec
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
170
|
version: '0'
|
165
171
|
requirements: []
|
166
172
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.6
|
173
|
+
rubygems_version: 2.7.6
|
168
174
|
signing_key:
|
169
175
|
specification_version: 4
|
170
176
|
summary: A drop-in replacement for e.g. MemCacheStore to store Rails sessions (and
|