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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d849f844f92e7e968078cf93d5802c868613bad0bfcefce1b72dd89724f76e3c
4
- data.tar.gz: 6c022fcdc3cdf7254ef738e7450530238fb813eed58b73055f7e851c8335fca4
3
+ metadata.gz: 90331bd500f283f691772c63fe0fd9800433c50aca9a380ff5bde853bf70fd19
4
+ data.tar.gz: 6d5b6f2f7017261c21f6265de114ac78d7febcfacfa50e308a56dcb15a4ae216
5
5
  SHA512:
6
- metadata.gz: b6c00740b8272f8626e3e4f902b927cefb50901e9fa7981d4a4b4e291d2c2bbbe9ab5d60c0b44453a38d08777aee818f4ae7218a7bc7e221996e54f659add5e4
7
- data.tar.gz: 6d39606e90215ecda6a7575231082da256381f765c457fc220a339a287618f820f8af44e3d2efb32fa160dc7351a51c92b4326afae5c670acd1b1292384aa5ec
6
+ metadata.gz: a7bb1ac24ac0cbc84f7d923047c8d05fdab9936c53bb1faa6b571617fc0b59706ca386527094aa5d2533cb9867dc00990404836b578077c4121805ee9eb4fce6
7
+ data.tar.gz: 50fa31bdfe84b874f97ee55e86eb8a575ad49eccd60f22b8315e23e1cf87e01940470b46ddf089ee9d5fc720112abf8010e1ae6983c85993baa20237c3380946
@@ -19,10 +19,18 @@ jobs:
19
19
  runs-on: ubuntu-latest
20
20
  strategy:
21
21
  matrix:
22
- ruby: [2.5, 2.6, 2.7, head, jruby-9.2.20.1, jruby-head]
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@v2
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
@@ -24,3 +24,4 @@ Redis Session Store authors
24
24
  - Peter Karman
25
25
  - Zach Margolis
26
26
  - Zachary Belzer
27
+ - Yutaka Kamei
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ # [0.11.5] - 2022-11-27
8
+
9
+ ### Changed
10
+
11
+ - Support redis 5
12
+ - Actionpack more than or equal to 6
13
+
7
14
  ## [0.11.4] - 2022-01-29
8
15
  ### Fixed
9
16
  - Use AbstractSecureStore for security fix
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
 
@@ -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.4'.freeze
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!(redis_options)
48
- @redis = redis_options[:client] || Redis.new(redis_options)
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]
@@ -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', '>= 3', '< 8'
19
- gem.add_runtime_dependency 'redis', '>= 3', '< 5'
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
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-01-29 00:00:00.000000000 Z
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: '3'
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: '3'
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: '5'
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: '5'
52
+ version: '6'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: fakeredis
55
55
  requirement: !ruby/object:Gem::Requirement