redis-session-store 0.11.4 → 0.11.5
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 +4 -4
- data/.github/workflows/ruby.yml +10 -2
- data/AUTHORS.md +1 -0
- data/CHANGELOG.md +7 -0
- data/README.md +5 -9
- data/lib/redis-session-store.rb +6 -8
- data/redis-session-store.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90331bd500f283f691772c63fe0fd9800433c50aca9a380ff5bde853bf70fd19
|
4
|
+
data.tar.gz: 6d5b6f2f7017261c21f6265de114ac78d7febcfacfa50e308a56dcb15a4ae216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7bb1ac24ac0cbc84f7d923047c8d05fdab9936c53bb1faa6b571617fc0b59706ca386527094aa5d2533cb9867dc00990404836b578077c4121805ee9eb4fce6
|
7
|
+
data.tar.gz: 50fa31bdfe84b874f97ee55e86eb8a575ad49eccd60f22b8315e23e1cf87e01940470b46ddf089ee9d5fc720112abf8010e1ae6983c85993baa20237c3380946
|
data/.github/workflows/ruby.yml
CHANGED
@@ -19,10 +19,18 @@ jobs:
|
|
19
19
|
runs-on: ubuntu-latest
|
20
20
|
strategy:
|
21
21
|
matrix:
|
22
|
-
ruby:
|
22
|
+
ruby:
|
23
|
+
- 2.5
|
24
|
+
- 2.6
|
25
|
+
- 2.7
|
26
|
+
- '3.0'
|
27
|
+
- 3.1
|
28
|
+
- head
|
29
|
+
- jruby-9.2.20.1
|
30
|
+
- jruby-head
|
23
31
|
|
24
32
|
steps:
|
25
|
-
- uses: actions/checkout@
|
33
|
+
- uses: actions/checkout@v3
|
26
34
|
- name: Set up Ruby
|
27
35
|
uses: ruby/setup-ruby@v1
|
28
36
|
with:
|
data/AUTHORS.md
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -32,7 +32,7 @@ See `lib/redis-session-store.rb` for a list of valid options.
|
|
32
32
|
In your Rails app, throw in an initializer with the following contents:
|
33
33
|
|
34
34
|
``` ruby
|
35
|
-
Rails.application.config.session_store :redis_session_store,
|
35
|
+
Rails.application.config.session_store :redis_session_store,
|
36
36
|
key: 'your_session_key',
|
37
37
|
redis: {
|
38
38
|
expire_after: 120.minutes, # cookie expiration
|
@@ -40,7 +40,6 @@ Rails.application.config.session_store :redis_session_store, {
|
|
40
40
|
key_prefix: 'myapp:session:',
|
41
41
|
url: 'redis://localhost:6379/0',
|
42
42
|
}
|
43
|
-
}
|
44
43
|
```
|
45
44
|
|
46
45
|
### Redis unavailability handling
|
@@ -49,13 +48,12 @@ If you want to handle cases where Redis is unavailable, a custom
|
|
49
48
|
callable handler may be provided as `on_redis_down`:
|
50
49
|
|
51
50
|
``` ruby
|
52
|
-
Rails.application.config.session_store :redis_session_store,
|
51
|
+
Rails.application.config.session_store :redis_session_store,
|
53
52
|
# ... other options ...
|
54
53
|
on_redis_down: ->(e, env, sid) { do_something_will_ya!(e) }
|
55
54
|
redis: {
|
56
55
|
# ... redis options ...
|
57
56
|
}
|
58
|
-
}
|
59
57
|
```
|
60
58
|
|
61
59
|
### Serializer
|
@@ -69,13 +67,12 @@ custom serializer:
|
|
69
67
|
* `CustomClass` - You can just pass the constant name of any class that responds to `.load` and `.dump`
|
70
68
|
|
71
69
|
``` ruby
|
72
|
-
Rails.application.config.session_store :redis_session_store,
|
70
|
+
Rails.application.config.session_store :redis_session_store,
|
73
71
|
# ... other options ...
|
74
72
|
serializer: :hybrid
|
75
73
|
redis: {
|
76
74
|
# ... redis options ...
|
77
75
|
}
|
78
|
-
}
|
79
76
|
```
|
80
77
|
|
81
78
|
**Note**: Rails 4 is required for using the `:json` and `:hybrid` serializers
|
@@ -88,20 +85,19 @@ custom callable handler may be provided as `on_session_load_error` which
|
|
88
85
|
will be given the error and the session ID.
|
89
86
|
|
90
87
|
``` ruby
|
91
|
-
Rails.application.config.session_store :redis_session_store,
|
88
|
+
Rails.application.config.session_store :redis_session_store,
|
92
89
|
# ... other options ...
|
93
90
|
on_session_load_error: ->(e, sid) { do_something_will_ya!(e) }
|
94
91
|
redis: {
|
95
92
|
# ... redis options ...
|
96
93
|
}
|
97
|
-
}
|
98
94
|
```
|
99
95
|
|
100
96
|
**Note** The session will *always* be destroyed when it cannot be loaded.
|
101
97
|
|
102
98
|
### Other notes
|
103
99
|
|
104
|
-
It returns with_indifferent_access if ActiveSupport is defined
|
100
|
+
It returns with_indifferent_access if ActiveSupport is defined.
|
105
101
|
|
106
102
|
## Rails 2 Compatibility
|
107
103
|
|
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::AbstractSecureStore
|
6
|
-
VERSION = '0.11.
|
6
|
+
VERSION = '0.11.5'.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
|
@@ -27,25 +27,23 @@ class RedisSessionStore < ActionDispatch::Session::AbstractSecureStore
|
|
27
27
|
#
|
28
28
|
# ==== Examples
|
29
29
|
#
|
30
|
-
# Rails.application.config.session_store :redis_session_store,
|
30
|
+
# Rails.application.config.session_store :redis_session_store,
|
31
31
|
# key: 'your_session_key',
|
32
32
|
# redis: {
|
33
33
|
# expire_after: 120.minutes,
|
34
34
|
# key_prefix: 'myapp:session:',
|
35
35
|
# url: 'redis://localhost:6379/0'
|
36
36
|
# },
|
37
|
-
# on_redis_down: ->(*a) { logger.error("Redis down! #{a.inspect}") }
|
37
|
+
# on_redis_down: ->(*a) { logger.error("Redis down! #{a.inspect}") },
|
38
38
|
# serializer: :hybrid # migrate from Marshal to JSON
|
39
|
-
# }
|
40
39
|
#
|
41
40
|
def initialize(app, options = {})
|
42
41
|
super
|
43
42
|
|
44
|
-
redis_options = options[:redis] || {}
|
45
|
-
|
46
43
|
@default_options[:namespace] = 'rack:session'
|
47
|
-
@default_options.merge!(
|
48
|
-
|
44
|
+
@default_options.merge!(options[:redis] || {})
|
45
|
+
init_options = options[:redis]&.reject { |k, _v| %i[expire_after key_prefix].include?(k) } || {}
|
46
|
+
@redis = init_options[:client] || Redis.new(init_options)
|
49
47
|
@on_redis_down = options[:on_redis_down]
|
50
48
|
@serializer = determine_serializer(options[:serializer])
|
51
49
|
@on_session_load_error = options[:on_session_load_error]
|
data/redis-session-store.gemspec
CHANGED
@@ -15,8 +15,8 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.version = File.read('lib/redis-session-store.rb')
|
16
16
|
.match(/^ VERSION = '(.*)'/)[1]
|
17
17
|
|
18
|
-
gem.add_runtime_dependency 'actionpack', '>=
|
19
|
-
gem.add_runtime_dependency 'redis', '>= 3', '<
|
18
|
+
gem.add_runtime_dependency 'actionpack', '>= 6', '< 8'
|
19
|
+
gem.add_runtime_dependency 'redis', '>= 3', '< 6'
|
20
20
|
|
21
21
|
gem.add_development_dependency 'fakeredis', '~> 0.8'
|
22
22
|
gem.add_development_dependency 'rake', '~> 13'
|
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.11.
|
4
|
+
version: 0.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '8'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '6'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '8'
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '3'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '6'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '3'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
52
|
+
version: '6'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: fakeredis
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|