redis-client-session-store 0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +42 -0
- data/.gitignore +16 -0
- data/.gitmodules +3 -0
- data/.rspec +3 -0
- data/.rubocop.yml +43 -0
- data/.rubocop_todo.yml +67 -0
- data/.simplecov +5 -0
- data/AUTHORS.md +29 -0
- data/CODE_OF_CONDUCT.md +75 -0
- data/CONTRIBUTING.md +6 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +144 -0
- data/LICENSE +22 -0
- data/README.md +99 -0
- data/Rakefile +15 -0
- data/lib/redis-client-session-store.rb +225 -0
- data/redis-client-session-store.gemspec +26 -0
- data/spec/redis_client_session_store_spec.rb +646 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/support/redis_double.rb +9 -0
- data/spec/support.rb +86 -0
- metadata +186 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: db7a4a07be6c7fab4598da8a222eb32fb46145625d90842560bba0ba4a2a4d49
|
4
|
+
data.tar.gz: 8e2b69531d7dd324de9096cb5322a7bedffc9a01ada04fcb0fd0622743b498ec
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 10e08e8ce5603ddb32ddd14eef0df85aa069dfac2965204a5571dba20ed2588e6f9296048fdbf3dca3a29d2d805a022d4b4b20bb415dd1f87353ae9df381b483
|
7
|
+
data.tar.gz: 7babf4ff1408aa7e23d55fd95525aecab64185d437130452f054537d3e6afbf3b14b61efd6975bab889df63c9cb09d922788c42ecee2b16a863d453b00b3d326
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
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
|
31
|
+
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v3
|
34
|
+
- name: Set up Ruby
|
35
|
+
uses: ruby/setup-ruby@v1
|
36
|
+
with:
|
37
|
+
ruby-version: ${{ matrix.ruby }}
|
38
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
39
|
+
continue-on-error: true
|
40
|
+
- name: Run tests
|
41
|
+
run: bundle exec rake
|
42
|
+
continue-on-error: true
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require:
|
4
|
+
- rubocop-rake
|
5
|
+
- rubocop-rspec
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
DisplayCopNames: true
|
9
|
+
Exclude:
|
10
|
+
- 'Rakefile'
|
11
|
+
- 'vendor/**/*'
|
12
|
+
- 'spec/support/redis-client/**/*'
|
13
|
+
|
14
|
+
Naming/FileName:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/DoubleNegation:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/BlockLength:
|
21
|
+
Exclude:
|
22
|
+
- 'spec/**/*.rb'
|
23
|
+
|
24
|
+
Layout/LineLength:
|
25
|
+
Max: 100
|
26
|
+
|
27
|
+
Metrics/ClassLength:
|
28
|
+
Max: 140
|
29
|
+
|
30
|
+
RSpec/MultipleExpectations:
|
31
|
+
Max: 3
|
32
|
+
|
33
|
+
Security/MarshalLoad:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/FrozenStringLiteralComment:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/PercentLiteralDelimiters:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Style/SafeNavigation:
|
43
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2022-01-29 11:55:33 UTC using RuboCop version 1.25.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'redis-session-store.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 6
|
17
|
+
# Configuration parameters: Prefixes.
|
18
|
+
# Prefixes: when, with, without
|
19
|
+
RSpec/ContextWording:
|
20
|
+
Exclude:
|
21
|
+
- 'spec/redis_session_store_spec.rb'
|
22
|
+
|
23
|
+
# Offense count: 2
|
24
|
+
# Configuration parameters: CountAsOne.
|
25
|
+
RSpec/ExampleLength:
|
26
|
+
Max: 9
|
27
|
+
|
28
|
+
# Offense count: 5
|
29
|
+
# Configuration parameters: AssignmentOnly.
|
30
|
+
RSpec/InstanceVariable:
|
31
|
+
Exclude:
|
32
|
+
- 'spec/redis_session_store_spec.rb'
|
33
|
+
|
34
|
+
# Offense count: 8
|
35
|
+
# Configuration parameters: .
|
36
|
+
# SupportedStyles: have_received, receive
|
37
|
+
RSpec/MessageSpies:
|
38
|
+
EnforcedStyle: receive
|
39
|
+
|
40
|
+
# Offense count: 5
|
41
|
+
RSpec/MultipleExpectations:
|
42
|
+
Max: 2
|
43
|
+
|
44
|
+
# Offense count: 17
|
45
|
+
# Configuration parameters: AllowSubject.
|
46
|
+
RSpec/MultipleMemoizedHelpers:
|
47
|
+
Max: 10
|
48
|
+
|
49
|
+
# Offense count: 13
|
50
|
+
RSpec/NestedGroups:
|
51
|
+
Max: 5
|
52
|
+
|
53
|
+
# Offense count: 2
|
54
|
+
RSpec/StubbedMock:
|
55
|
+
Exclude:
|
56
|
+
- 'spec/redis_session_store_spec.rb'
|
57
|
+
|
58
|
+
# Offense count: 20
|
59
|
+
RSpec/SubjectStub:
|
60
|
+
Exclude:
|
61
|
+
- 'spec/redis_session_store_spec.rb'
|
62
|
+
|
63
|
+
# Offense count: 16
|
64
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
65
|
+
RSpec/VerifiedDoubles:
|
66
|
+
Exclude:
|
67
|
+
- 'spec/redis_session_store_spec.rb'
|
data/.simplecov
ADDED
data/AUTHORS.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Redis Session Store authors
|
2
|
+
===========================
|
3
|
+
|
4
|
+
- Andrey "Zed" Zaikin
|
5
|
+
- Ben Marini
|
6
|
+
- Bill Ruddock
|
7
|
+
- Dan Buch
|
8
|
+
- Donald Plummer
|
9
|
+
- Edwin Cruz
|
10
|
+
- Gonçalo Silva
|
11
|
+
- Ian C. Anderson
|
12
|
+
- Jesse Doyle
|
13
|
+
- Jorge Pardiñas
|
14
|
+
- Justin McNally
|
15
|
+
- Mathias Meyer
|
16
|
+
- Michael Fields
|
17
|
+
- Michael Xavier
|
18
|
+
- Olek Poplavsky
|
19
|
+
- Tim Lossen
|
20
|
+
- Todd Bealmear
|
21
|
+
- Aleksey Dashkevych
|
22
|
+
- Olle Jonsson
|
23
|
+
- Nicolas Rodriguez
|
24
|
+
- Sergey Nebolsin
|
25
|
+
- Anton Kolodii
|
26
|
+
- Peter Karman
|
27
|
+
- Zach Margolis
|
28
|
+
- Zachary Belzer
|
29
|
+
- Yutaka Kamei
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team via [github
|
59
|
+
issues](https://github.com/zed-0xff/redis-client-session-store/issues). All
|
60
|
+
complaints will be reviewed and investigated and will result in a response that
|
61
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
62
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
63
|
+
Further details of specific enforcement policies may be posted separately.
|
64
|
+
|
65
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
66
|
+
faith may face temporary or permanent repercussions as determined by other
|
67
|
+
members of the project's leadership.
|
68
|
+
|
69
|
+
## Attribution
|
70
|
+
|
71
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
72
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
73
|
+
|
74
|
+
[homepage]: http://contributor-covenant.org
|
75
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
redis-client-session-store (0.12)
|
5
|
+
actionpack (>= 5.2.4.1, < 8)
|
6
|
+
redis-client
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (7.1.2)
|
12
|
+
actionview (= 7.1.2)
|
13
|
+
activesupport (= 7.1.2)
|
14
|
+
nokogiri (>= 1.8.5)
|
15
|
+
racc
|
16
|
+
rack (>= 2.2.4)
|
17
|
+
rack-session (>= 1.0.1)
|
18
|
+
rack-test (>= 0.6.3)
|
19
|
+
rails-dom-testing (~> 2.2)
|
20
|
+
rails-html-sanitizer (~> 1.6)
|
21
|
+
actionview (7.1.2)
|
22
|
+
activesupport (= 7.1.2)
|
23
|
+
builder (~> 3.1)
|
24
|
+
erubi (~> 1.11)
|
25
|
+
rails-dom-testing (~> 2.2)
|
26
|
+
rails-html-sanitizer (~> 1.6)
|
27
|
+
activesupport (7.1.2)
|
28
|
+
base64
|
29
|
+
bigdecimal
|
30
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
+
connection_pool (>= 2.2.5)
|
32
|
+
drb
|
33
|
+
i18n (>= 1.6, < 2)
|
34
|
+
minitest (>= 5.1)
|
35
|
+
mutex_m
|
36
|
+
tzinfo (~> 2.0)
|
37
|
+
ast (2.4.2)
|
38
|
+
base64 (0.2.0)
|
39
|
+
bigdecimal (3.1.5)
|
40
|
+
builder (3.2.4)
|
41
|
+
concurrent-ruby (1.2.2)
|
42
|
+
connection_pool (2.4.1)
|
43
|
+
crass (1.0.6)
|
44
|
+
diff-lcs (1.5.0)
|
45
|
+
docile (1.4.0)
|
46
|
+
drb (2.2.0)
|
47
|
+
ruby2_keywords
|
48
|
+
erubi (1.12.0)
|
49
|
+
i18n (1.14.1)
|
50
|
+
concurrent-ruby (~> 1.0)
|
51
|
+
json (2.7.1)
|
52
|
+
language_server-protocol (3.17.0.3)
|
53
|
+
loofah (2.22.0)
|
54
|
+
crass (~> 1.0.2)
|
55
|
+
nokogiri (>= 1.12.0)
|
56
|
+
minitest (5.20.0)
|
57
|
+
mutex_m (0.2.0)
|
58
|
+
nokogiri (1.16.0-arm64-darwin)
|
59
|
+
racc (~> 1.4)
|
60
|
+
parallel (1.24.0)
|
61
|
+
parser (3.2.2.4)
|
62
|
+
ast (~> 2.4.1)
|
63
|
+
racc
|
64
|
+
racc (1.7.3)
|
65
|
+
rack (3.0.8)
|
66
|
+
rack-session (2.0.0)
|
67
|
+
rack (>= 3.0.0)
|
68
|
+
rack-test (2.1.0)
|
69
|
+
rack (>= 1.3)
|
70
|
+
rails-dom-testing (2.2.0)
|
71
|
+
activesupport (>= 5.0.0)
|
72
|
+
minitest
|
73
|
+
nokogiri (>= 1.6)
|
74
|
+
rails-html-sanitizer (1.6.0)
|
75
|
+
loofah (~> 2.21)
|
76
|
+
nokogiri (~> 1.14)
|
77
|
+
rainbow (3.1.1)
|
78
|
+
rake (13.1.0)
|
79
|
+
redis-client (0.19.1)
|
80
|
+
connection_pool
|
81
|
+
regexp_parser (2.8.3)
|
82
|
+
rexml (3.2.6)
|
83
|
+
rspec (3.12.0)
|
84
|
+
rspec-core (~> 3.12.0)
|
85
|
+
rspec-expectations (~> 3.12.0)
|
86
|
+
rspec-mocks (~> 3.12.0)
|
87
|
+
rspec-core (3.12.2)
|
88
|
+
rspec-support (~> 3.12.0)
|
89
|
+
rspec-expectations (3.12.3)
|
90
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
91
|
+
rspec-support (~> 3.12.0)
|
92
|
+
rspec-mocks (3.12.6)
|
93
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
94
|
+
rspec-support (~> 3.12.0)
|
95
|
+
rspec-support (3.12.1)
|
96
|
+
rubocop (1.59.0)
|
97
|
+
json (~> 2.3)
|
98
|
+
language_server-protocol (>= 3.17.0)
|
99
|
+
parallel (~> 1.10)
|
100
|
+
parser (>= 3.2.2.4)
|
101
|
+
rainbow (>= 2.2.2, < 4.0)
|
102
|
+
regexp_parser (>= 1.8, < 3.0)
|
103
|
+
rexml (>= 3.2.5, < 4.0)
|
104
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
105
|
+
ruby-progressbar (~> 1.7)
|
106
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
107
|
+
rubocop-ast (1.30.0)
|
108
|
+
parser (>= 3.2.1.0)
|
109
|
+
rubocop-capybara (2.19.0)
|
110
|
+
rubocop (~> 1.41)
|
111
|
+
rubocop-factory_bot (2.24.0)
|
112
|
+
rubocop (~> 1.33)
|
113
|
+
rubocop-rake (0.6.0)
|
114
|
+
rubocop (~> 1.0)
|
115
|
+
rubocop-rspec (2.25.0)
|
116
|
+
rubocop (~> 1.40)
|
117
|
+
rubocop-capybara (~> 2.17)
|
118
|
+
rubocop-factory_bot (~> 2.22)
|
119
|
+
ruby-progressbar (1.13.0)
|
120
|
+
ruby2_keywords (0.0.5)
|
121
|
+
simplecov (0.22.0)
|
122
|
+
docile (~> 1.1)
|
123
|
+
simplecov-html (~> 0.11)
|
124
|
+
simplecov_json_formatter (~> 0.1)
|
125
|
+
simplecov-html (0.12.3)
|
126
|
+
simplecov_json_formatter (0.1.4)
|
127
|
+
tzinfo (2.0.6)
|
128
|
+
concurrent-ruby (~> 1.0)
|
129
|
+
unicode-display_width (2.5.0)
|
130
|
+
|
131
|
+
PLATFORMS
|
132
|
+
arm64-darwin-21
|
133
|
+
|
134
|
+
DEPENDENCIES
|
135
|
+
rake (~> 13)
|
136
|
+
redis-client-session-store!
|
137
|
+
rspec (~> 3)
|
138
|
+
rubocop (~> 1.25)
|
139
|
+
rubocop-rake (~> 0.6)
|
140
|
+
rubocop-rspec (~> 2.8)
|
141
|
+
simplecov (~> 0.21)
|
142
|
+
|
143
|
+
BUNDLED WITH
|
144
|
+
2.3.26
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Mathias Meyer and contributors
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# RedisClient Session Store
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/github/zed-0xff/redis-client-session-store.svg)](https://codeclimate.com/github/zed-0xff/redis-client-session-store)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/redis-client-session-store.svg)](http://badge.fury.io/rb/redis-client-session-store)
|
5
|
+
|
6
|
+
A fork of [redis-session-store](https://github.com/roidrage/redis-session-store)
|
7
|
+
using low-level RESP3 wrapper [redis-client](https://github.com/redis-rb/redis-client)
|
8
|
+
instead of idiomatic [redis](https://github.com/redis/redis-rb).
|
9
|
+
|
10
|
+
This library doesn't offer anything related to caching, and is
|
11
|
+
only suitable for Rails applications. For other frameworks or
|
12
|
+
drop-in support for caching, check out
|
13
|
+
[redis-store](http://github.com/jodosha/redis-store/).
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
For Rails 3+, adding this to your `Gemfile` will do the trick.
|
18
|
+
|
19
|
+
``` ruby
|
20
|
+
gem 'redis-client-session-store'
|
21
|
+
```
|
22
|
+
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
See `lib/redis-client-session-store.rb` for a list of valid options.
|
26
|
+
In your Rails app, throw in an initializer with the following contents:
|
27
|
+
|
28
|
+
``` ruby
|
29
|
+
Rails.application.config.session_store :redis_client_session_store,
|
30
|
+
key: 'your_session_key',
|
31
|
+
redis: {
|
32
|
+
expire_after: 120.minutes, # cookie expiration
|
33
|
+
ttl: 120.minutes, # Redis expiration, defaults to 'expire_after'
|
34
|
+
key_prefix: 'myapp:session:',
|
35
|
+
url: 'redis://localhost:6379/0',
|
36
|
+
}
|
37
|
+
```
|
38
|
+
|
39
|
+
### Redis unavailability handling
|
40
|
+
|
41
|
+
If you want to handle cases where Redis is unavailable, a custom
|
42
|
+
callable handler may be provided as `on_redis_down`:
|
43
|
+
|
44
|
+
``` ruby
|
45
|
+
Rails.application.config.session_store :redis_client_session_store,
|
46
|
+
# ... other options ...
|
47
|
+
on_redis_down: ->(e, env, sid) { do_something_will_ya!(e) }
|
48
|
+
redis: {
|
49
|
+
# ... redis options ...
|
50
|
+
}
|
51
|
+
```
|
52
|
+
|
53
|
+
### Serializer
|
54
|
+
|
55
|
+
By default the Marshal serializer is used. With Rails 4, you can use JSON as a
|
56
|
+
custom serializer:
|
57
|
+
|
58
|
+
* `:json` - serialize cookie values with `JSON` (Requires Rails 4+)
|
59
|
+
* `:marshal` - serialize cookie values with `Marshal` (Default)
|
60
|
+
* `:hybrid` - transparently migrate existing `Marshal` cookie values to `JSON` (Requires Rails 4+)
|
61
|
+
* `CustomClass` - You can just pass the constant name of any class that responds to `.load` and `.dump`
|
62
|
+
|
63
|
+
``` ruby
|
64
|
+
Rails.application.config.session_store :redis_client_session_store,
|
65
|
+
# ... other options ...
|
66
|
+
serializer: :hybrid
|
67
|
+
redis: {
|
68
|
+
# ... redis options ...
|
69
|
+
}
|
70
|
+
```
|
71
|
+
|
72
|
+
**Note**: Rails 4 is required for using the `:json` and `:hybrid` serializers
|
73
|
+
because the `Flash` object doesn't serialize well in 3.2. See [Rails #13945](https://github.com/rails/rails/pull/13945) for more info.
|
74
|
+
|
75
|
+
### Session load error handling
|
76
|
+
|
77
|
+
If you want to handle cases where the session data cannot be loaded, a
|
78
|
+
custom callable handler may be provided as `on_session_load_error` which
|
79
|
+
will be given the error and the session ID.
|
80
|
+
|
81
|
+
``` ruby
|
82
|
+
Rails.application.config.session_store :redis_client_session_store,
|
83
|
+
# ... other options ...
|
84
|
+
on_session_load_error: ->(e, sid) { do_something_will_ya!(e) }
|
85
|
+
redis: {
|
86
|
+
# ... redis options ...
|
87
|
+
}
|
88
|
+
```
|
89
|
+
|
90
|
+
**Note** The session will *always* be destroyed when it cannot be loaded.
|
91
|
+
|
92
|
+
### Other notes
|
93
|
+
|
94
|
+
It returns with_indifferent_access if ActiveSupport is defined.
|
95
|
+
|
96
|
+
## Contributing, Authors, & License
|
97
|
+
|
98
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md), [AUTHORS.md](AUTHORS.md), and
|
99
|
+
[LICENSE](LICENSE), respectively.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
4
|
+
|
5
|
+
task default: [:rubocop, :coverage]
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new
|
8
|
+
|
9
|
+
desc 'Run specs with coverage'
|
10
|
+
task :coverage do
|
11
|
+
ENV['COVERAGE'] = '1'
|
12
|
+
Rake::Task['spec'].invoke
|
13
|
+
end
|
14
|
+
|
15
|
+
RuboCop::RakeTask.new
|