brevio-session-store 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c8f67e9e361415ba43f4f011b43ca47afbd756dfd5be138a561931d61e8c4dfc
4
+ data.tar.gz: 817478ad26708c2499f0fb1ac1aee1ac1dc6396fa3d48e332aca42910d1ba610
5
+ SHA512:
6
+ metadata.gz: 512e40cfb34c3040642f5ecd76c81131acb3ff72a647fa96f47634f233be5e8cb5f99bbe0c7c3ec5e8bd4aee61e85087cfc1443c58999d0c8434efac5726d0ec
7
+ data.tar.gz: 923603e66e37be4604d16afa90e88b8fe39b6de2d321f0d507c0113c82caed001db689f2a4509f6c391867cb75cc201bfe6b5f3fd9af8373a08d921fc5021625
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,38 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ Exclude:
4
+ - 'Rakefile'
5
+ - 'vendor/**/*'
6
+
7
+ Naming/FileName:
8
+ Enabled: false
9
+
10
+ Style/DoubleNegation:
11
+ Enabled: false
12
+
13
+ Metrics/BlockLength:
14
+ Exclude:
15
+ - 'spec/**/*.rb'
16
+
17
+ Layout/LineLength:
18
+ Max: 100
19
+
20
+ Metrics/ClassLength:
21
+ Max: 120
22
+
23
+ Security/MarshalLoad:
24
+ Enabled: false
25
+
26
+ Style/FrozenStringLiteralComment:
27
+ Enabled: false
28
+
29
+ Style/PercentLiteralDelimiters:
30
+ Enabled: false
31
+
32
+ Style/SafeNavigation:
33
+ Enabled: false
34
+
35
+ Style/YodaCondition:
36
+ # temporary work around for rubocop bug 'An error occurred while Style/YodaCondition...' (v0.49.1)
37
+ Exclude:
38
+ - 'spec/redis_session_store_spec.rb'
data/.simplecov ADDED
@@ -0,0 +1,5 @@
1
+ if ENV['COVERAGE']
2
+ SimpleCov.start do
3
+ add_filter '/spec/'
4
+ end
5
+ end
data/.travis.yml ADDED
@@ -0,0 +1,24 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.3
5
+ - 2.4
6
+ - 2.5
7
+ - 2.6
8
+ - ruby-head
9
+ - jruby-9.2.12.0
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: ruby-head
13
+ - rvm: jruby-9.2.12.0
14
+ notifications:
15
+ email: false
16
+ deploy:
17
+ provider: rubygems
18
+ api_key:
19
+ secure: jL1lH/wfeRa5MoZRHvkXcZP/Ch7huFxqzbvhEV7UZhiDUBnApcJWkb346jeLEDYnFObUhqhaCZ1/l4fDeSFg2GgatSfEnoWATFVkIf1e4TTGAePlS+4qqsGOcr+XrjP6CEf4o4JACdLuSoT9dtUFj0xkFLnDWILxneXIrqDE9VU=
20
+ gem: redis-session-store
21
+ on:
22
+ tags: true
23
+ repo: roidrage/redis-session-store
24
+ rvm: 2.6.6
data/AUTHORS.md ADDED
@@ -0,0 +1,25 @@
1
+ Redis Session Store authors
2
+ ===========================
3
+
4
+ - Ben Marini
5
+ - Dan Buch
6
+ - Donald Plummer
7
+ - Edwin Cruz
8
+ - Gonçalo Silva
9
+ - Ian C. Anderson
10
+ - Jesse Doyle
11
+ - Jorge Pardiñas
12
+ - Justin McNally
13
+ - Mathias Meyer
14
+ - Michael Fields
15
+ - Michael Xavier
16
+ - Olek Poplavsky
17
+ - Tim Lossen
18
+ - Todd Bealmear
19
+ - Aleksey Dashkevych
20
+ - Olle Jonsson
21
+ - Nicolas Rodriguez
22
+ - Sergey Nebolsin
23
+ - Anton Kolodii
24
+ - Peter Karman
25
+ - Zach Margolis
data/CHANGELOG.md ADDED
@@ -0,0 +1,269 @@
1
+ # Change Log
2
+
3
+ **ATTN**: This project uses [semantic versioning](http://semver.org/).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.11.3] - 2020-07-23
8
+ ### Fixed
9
+ - https://github.com/roidrage/redis-session-store/issues/121
10
+
11
+ ## [0.11.2] - 2020-07-22
12
+ ### Changed
13
+ - Silence deprecation warning when using with redis gem v4.2+
14
+
15
+ ## [0.11.1] - 2019-08-22
16
+ ### Changed
17
+ - Remove the `has_rdoc` parameter from the `.gemspec` file as it has been deprecated.
18
+ - Actionpack to '>= 3', remove upper dependency
19
+
20
+ ## [0.11.0] - 2018-08-13
21
+ ### Changed
22
+ - JRuby to jruby-9.2.0.0
23
+ - Travis Ruby support: 2.3.7, 2.4.4, 2.5.1
24
+
25
+ ### Added
26
+ - :ttl configuration option
27
+
28
+ ## [0.10.0] - 2018-04-14
29
+ ### Changed
30
+ - JRuby to jruby-9.1.15.0
31
+ - Redis to '>= 3', '< 5'
32
+ - Actionpack to '>= 3', '< 6'
33
+ - Rake to 12
34
+
35
+ ### Added
36
+ - with_indifferent_access if defined ActiveSupport
37
+
38
+ ## [0.9.2] - 2017-10-31
39
+ ### Changed
40
+ - Actionpack to 5.1
41
+ - Travis use jruby 9.1.13.0
42
+
43
+ ## [0.9.1] - 2016-07-03
44
+ ### Added
45
+ - More specific runtime dependencies
46
+
47
+ ### Changed
48
+ - Documentation and whitespace
49
+
50
+ ## [0.9.0] - 2016-07-02
51
+ ### Added
52
+ - [`CODE_OF_CONDUCT.md`](./CODE_OF_CONDUCT.md)
53
+ - Method alias for `#delete_session` -&gt; `#destroy_session`
54
+
55
+ ### Changed
56
+ - Tested version of Ruby 2 up to 2.3.1
57
+ - Session config examples to use `redis: { url: '...' }`
58
+
59
+ ### Removed
60
+ - Ruby 1.9.3 support due to Rack 2 requirements
61
+
62
+ ## [0.8.1] - 2016-01-25
63
+ ### Added
64
+ - Support for Rails 5 and Rack 2
65
+
66
+ ### Changed
67
+ - Error support for redis-rb v3 gem
68
+
69
+ ## [0.8.0] - 2014-08-28
70
+ ### Added
71
+ - Allow for injection of custom redis client
72
+ - Explicitly declare actionpack dependency
73
+
74
+ ### Changed
75
+ - Spec updates for rspec 3
76
+
77
+ ## [0.7.0] - 2014-04-22
78
+ ### Fixed
79
+ - Issue #38, we now delay writing to redis until a session exists. This is a
80
+ backwards-incompatible change, as it removes the `on_sid_collision` option.
81
+ There is now no checking for sid collisions, however that is very unlikely.
82
+
83
+ ## [0.6.6] - 2014-04-08
84
+ ### Fixed
85
+ - Issue #37, use correct constant for `ENV_SESSION_OPTIONS_KEY` if not passed.
86
+
87
+ ## [0.6.5] - 2014-04-04
88
+ ### Fixed
89
+ - Issue #36, use setnx to get a new session id instead of get. This prevents a
90
+ very rare id collision.
91
+
92
+ ## [0.6.4] - 2014-04-04
93
+ ### Removed
94
+ - `#setnx` usage in v0.6.3 so we can change our sessions
95
+
96
+ ## [0.6.3] - 2014-04-01
97
+ ### Changed
98
+ - Setting session ID with a multi-call `#setnx` and `#expire` instead of
99
+ `#setex`.
100
+
101
+ ### Removed
102
+ - `#setnx` change in v0.6.2 as it behaved badly under load, hitting yet another
103
+ race condition issue and pegging the CPU.
104
+
105
+ ## [0.6.2] - 2014-03-31
106
+ ### Changed
107
+ - Use `#setnx` instead of `#get` when checking for session ID collisions, which
108
+ is slightly more paranoid and should help avoid a particularly nasty edge
109
+ case.
110
+
111
+ ## [0.6.1] - 2014-03-17
112
+ ### Fixed
113
+ - Compatibility with `ActionDispatch::Request::Session::Options` when destroying
114
+ sessions.
115
+
116
+ ## [0.6.0] - 2014-03-17
117
+ ### Added
118
+ - Custom serializer configuration
119
+ - Custom handling capability for session load errors
120
+
121
+ ### Changed
122
+ - Always destroying sessions that cannot be loaded
123
+
124
+ ## [0.5.0] - 2014-03-16
125
+ ### Added
126
+ - Support for `on_sid_collision` handler option
127
+ - Support for `on_redis_down` handler option
128
+
129
+ ### Changed
130
+ - Keep generating session IDs until one is found that doesn't collide
131
+ with existing session IDs
132
+
133
+ ### Removed
134
+ - **BACKWARD INCOMPATIBLE** Drop support for `:raise_errors` option
135
+
136
+ ## [0.4.2] - 2014-03-14
137
+ ### Changed
138
+ - Renaming `load_session` method to not conflict with AbstractStore
139
+
140
+ ## [0.4.1] - (2014-03-13) [YANKED]
141
+ ### Changed
142
+ - Regenerate session ID when session is missing
143
+
144
+ ## [0.4.0] - 2014-02-19
145
+ ### Added
146
+ - Support for `ENV_SESSION_OPTIONS_KEY` rack env option
147
+ - Support for `:raise_errors` session option (kinda like Dalli)
148
+
149
+ ### Changed
150
+ - Increasing test coverage
151
+
152
+ ## [0.3.1] - 2014-02-19
153
+ ### Added
154
+ - `#destroy_session` method
155
+
156
+ ### Changed
157
+ - Clean up remaining RuboCop offenses
158
+ - Documentation updates
159
+
160
+ ## [0.3.0] - 2014-02-13
161
+ ### Added
162
+ - Rails 3 compatibility
163
+ - Add test coverage
164
+
165
+ ### Changed
166
+ - Switch from minitest to rspec
167
+ - RuboCop cleanup
168
+
169
+ ## [0.2.4] - 2014-03-16
170
+ ### Changed
171
+ - Keep generating session IDs until one is found that doesn't collide
172
+ with existing session IDs
173
+
174
+ ## [0.2.3] - 2014-03-14
175
+ ### Changed
176
+ - Renaming `load_session` method to not conflict with AbstractStore
177
+
178
+ ## [0.2.2] - 2014-03-13 [YANKED]
179
+ ### Changed
180
+ - Regenerate session ID when session is missing
181
+
182
+ ## [0.2.1] - 2013-09-17
183
+ ### Added
184
+ - Explicit MIT license metadata in gemspec
185
+
186
+ ## [0.2.0] - 2013-09-13
187
+ ### Added
188
+ - Gemfile, gemspec, and git updates
189
+ - `#destroy` method
190
+ - Travis integration
191
+ - Some minimal tests to ensure backward compatibility session options
192
+
193
+ ### Changed
194
+ - Nest redis-specific options inside a `:redis` key of session options
195
+ - Rescue only `Errno::ECONNREFUSED` exceptions
196
+ - Handle `nil` cookies during `#destroy`
197
+
198
+ ## [0.1.9] - 2012-03-06
199
+ ### Changed
200
+ - Use `@redis.setex` when expiry provided, else `@redis.set`
201
+ - gemification
202
+ - Options hash to no longer expect redis options at same level
203
+
204
+ ## [0.1.8] - 2010-12-09
205
+ ### Removed
206
+ - Use of `@redis.pipelined`
207
+
208
+ ## 0.1.7 - 2010-12-08
209
+ ### Changed
210
+ - Using latest redis gem API
211
+
212
+ ## 0.1.6 - 2010-04-18
213
+ ### Changed
214
+ - Using pipelined format with `set` and `expire`
215
+ - Changing default port from 6370 to 6379
216
+
217
+ ## 0.1.5 - 2010-04-07
218
+
219
+ ## 0.1.4 - 2010-03-26
220
+ ### Changed
221
+ - Redis parameter from `:server` to `:host`
222
+
223
+ ## 0.1.3 - 2009-12-30
224
+ ### Changed
225
+ - Documentation updates
226
+
227
+ ## 0.1.2 - 2009-12-30
228
+ ### Changed
229
+ - Documentation updates
230
+
231
+ ## 0.1.1 - 2009-12-30
232
+ ### Changed
233
+ - library file renamed to `redis-session-store.rb` to play nicely with
234
+ rails require
235
+
236
+ ## 0.1 - 2009-12-30
237
+ ### Added
238
+ - first working version
239
+
240
+ [Unreleased]: https://github.com/roidrage/redis-session-store/compare/v0.11.1...HEAD
241
+ [0.11.1]: https://github.com/roidrage/redis-session-store/compare/v0.11.0...v0.11.1
242
+ [0.11.0]: https://github.com/roidrage/redis-session-store/compare/v0.10.0...v0.11.0
243
+ [0.10.0]: https://github.com/roidrage/redis-session-store/compare/v0.9.2...v0.10.0
244
+ [0.9.2]: https://github.com/roidrage/redis-session-store/compare/v0.9.1...v0.9.2
245
+ [0.9.1]: https://github.com/roidrage/redis-session-store/compare/v0.9.0...v0.9.1
246
+ [0.9.0]: https://github.com/roidrage/redis-session-store/compare/v0.8.1...v0.9.0
247
+ [0.8.1]: https://github.com/roidrage/redis-session-store/compare/v0.8.0...v0.8.1
248
+ [0.8.0]: https://github.com/roidrage/redis-session-store/compare/v0.7.0...v0.8.0
249
+ [0.7.0]: https://github.com/roidrage/redis-session-store/compare/v0.6.6...v0.7.0
250
+ [0.6.6]: https://github.com/roidrage/redis-session-store/compare/v0.6.5...v0.6.6
251
+ [0.6.5]: https://github.com/roidrage/redis-session-store/compare/v0.6.4...v0.6.5
252
+ [0.6.4]: https://github.com/roidrage/redis-session-store/compare/v0.6.3...v0.6.4
253
+ [0.6.3]: https://github.com/roidrage/redis-session-store/compare/v0.6.2...v0.6.3
254
+ [0.6.2]: https://github.com/roidrage/redis-session-store/compare/v0.6.1...v0.6.2
255
+ [0.6.1]: https://github.com/roidrage/redis-session-store/compare/v0.6.0...v0.6.1
256
+ [0.6.0]: https://github.com/roidrage/redis-session-store/compare/v0.5.0...v0.6.0
257
+ [0.5.0]: https://github.com/roidrage/redis-session-store/compare/v0.4.2...v0.5.0
258
+ [0.4.2]: https://github.com/roidrage/redis-session-store/compare/v0.4.1...v0.4.2
259
+ [0.4.1]: https://github.com/roidrage/redis-session-store/compare/v0.4.0...v0.4.1
260
+ [0.4.0]: https://github.com/roidrage/redis-session-store/compare/v0.3.1...v0.4.0
261
+ [0.3.1]: https://github.com/roidrage/redis-session-store/compare/v0.3.0...v0.3.1
262
+ [0.3.0]: https://github.com/roidrage/redis-session-store/compare/v0.2.4...v0.3.0
263
+ [0.2.4]: https://github.com/roidrage/redis-session-store/compare/v0.2.3...v0.2.4
264
+ [0.2.3]: https://github.com/roidrage/redis-session-store/compare/v0.2.2...v0.2.3
265
+ [0.2.2]: https://github.com/roidrage/redis-session-store/compare/v0.2.1...v0.2.2
266
+ [0.2.1]: https://github.com/roidrage/redis-session-store/compare/v0.2.0...v0.2.1
267
+ [0.2.0]: https://github.com/roidrage/redis-session-store/compare/v0.1.9...v0.2.0
268
+ [0.1.9]: https://github.com/roidrage/redis-session-store/compare/v0.1.8...v0.1.9
269
+ [0.1.8]: https://github.com/roidrage/redis-session-store/compare/v0.1.7...v0.1.8
@@ -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/roidrage/redis-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
@@ -0,0 +1,6 @@
1
+ Redis Session Store contribution guidelines
2
+ ===========================================
3
+
4
+ - Pull requests welcome!
5
+ - Please add yourself to the [AUTHORS.md](AUTHORS.md) file
6
+ alphabetically by first name.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
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,119 @@
1
+ # Redis Session Store
2
+
3
+ [![Build Status](https://travis-ci.org/roidrage/redis-session-store.svg?branch=master)](https://travis-ci.org/roidrage/redis-session-store)
4
+ [![Code Climate](https://codeclimate.com/github/roidrage/redis-session-store.svg)](https://codeclimate.com/github/roidrage/redis-session-store)
5
+ [![Gem Version](https://badge.fury.io/rb/redis-session-store.svg)](http://badge.fury.io/rb/redis-session-store)
6
+
7
+ A simple Redis-based session store for Rails. But why, you ask,
8
+ when there's [redis-store](http://github.com/jodosha/redis-store/)?
9
+ redis-store is a one-size-fits-all solution, and I found it not to work
10
+ properly with Rails, mostly due to a problem that seemed to lie in
11
+ Rack's `Abstract::ID` class. I wanted something that worked, so I
12
+ blatantly stole the code from Rails' `MemCacheStore` and turned it
13
+ into a Redis version. No support for fancy stuff like distributed
14
+ storage across several Redis instances. Feel free to add what you
15
+ see fit.
16
+
17
+ This library doesn't offer anything related to caching, and is
18
+ only suitable for Rails applications. For other frameworks or
19
+ drop-in support for caching, check out
20
+ [redis-store](http://github.com/jodosha/redis-store/).
21
+
22
+ ## Installation
23
+
24
+ For Rails 3+, adding this to your `Gemfile` will do the trick.
25
+
26
+ ``` ruby
27
+ gem 'redis-session-store'
28
+ ```
29
+
30
+ ## Configuration
31
+
32
+ See `lib/redis-session-store.rb` for a list of valid options.
33
+ In your Rails app, throw in an initializer with the following contents:
34
+
35
+ ``` ruby
36
+ Rails.application.config.session_store :redis_session_store, {
37
+ key: 'your_session_key',
38
+ redis: {
39
+ expire_after: 120.minutes, # cookie expiration
40
+ ttl: 120.minutes, # Redis expiration, defaults to 'expire_after'
41
+ key_prefix: 'myapp:session:',
42
+ url: 'redis://localhost:6379/0',
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### Redis unavailability handling
48
+
49
+ If you want to handle cases where Redis is unavailable, a custom
50
+ callable handler may be provided as `on_redis_down`:
51
+
52
+ ``` ruby
53
+ Rails.application.config.session_store :redis_session_store, {
54
+ # ... other options ...
55
+ on_redis_down: ->(e, env, sid) { do_something_will_ya!(e) }
56
+ redis: {
57
+ # ... redis options ...
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### Serializer
63
+
64
+ By default the Marshal serializer is used. With Rails 4, you can use JSON as a
65
+ custom serializer:
66
+
67
+ * `:json` - serialize cookie values with `JSON` (Requires Rails 4+)
68
+ * `:marshal` - serialize cookie values with `Marshal` (Default)
69
+ * `:hybrid` - transparently migrate existing `Marshal` cookie values to `JSON` (Requires Rails 4+)
70
+ * `CustomClass` - You can just pass the constant name of any class that responds to `.load` and `.dump`
71
+
72
+ ``` ruby
73
+ Rails.application.config.session_store :redis_session_store, {
74
+ # ... other options ...
75
+ serializer: :hybrid
76
+ redis: {
77
+ # ... redis options ...
78
+ }
79
+ }
80
+ ```
81
+
82
+ **Note**: Rails 4 is required for using the `:json` and `:hybrid` serializers
83
+ because the `Flash` object doesn't serialize well in 3.2. See [Rails #13945](https://github.com/rails/rails/pull/13945) for more info.
84
+
85
+ ### Session load error handling
86
+
87
+ If you want to handle cases where the session data cannot be loaded, a
88
+ custom callable handler may be provided as `on_session_load_error` which
89
+ will be given the error and the session ID.
90
+
91
+ ``` ruby
92
+ Rails.application.config.session_store :redis_session_store, {
93
+ # ... other options ...
94
+ on_session_load_error: ->(e, sid) { do_something_will_ya!(e) }
95
+ redis: {
96
+ # ... redis options ...
97
+ }
98
+ }
99
+ ```
100
+
101
+ **Note** The session will *always* be destroyed when it cannot be loaded.
102
+
103
+ ### Other notes
104
+
105
+ It returns with_indifferent_access if ActiveSupport is defined
106
+
107
+ ## Rails 2 Compatibility
108
+
109
+ This gem is currently only compatible with Rails 3+. If you need
110
+ Rails 2 compatibility, be sure to pin to a lower version like so:
111
+
112
+ ``` ruby
113
+ gem 'redis-session-store', '< 0.3'
114
+ ```
115
+
116
+ ## Contributing, Authors, & License
117
+
118
+ See [CONTRIBUTING.md](CONTRIBUTING.md), [AUTHORS.md](AUTHORS.md), and
119
+ [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