README.md in redis-session-store-0.5.0 vs README.md in redis-session-store-0.6.0

- old
+ new

@@ -78,9 +78,44 @@ # ... other options ... on_redis_down: ->(e, env, sid) { do_something_will_ya!(e) } } ``` +### Serializer + +By default the Marshal serializer is used. With Rails 4, you can use JSON as a +custom serializer: + +* `:json` - serialize cookie values with `JSON` (Requires Rails 4+) +* `:marshal` - serialize cookie values with `Marshal` (Default) +* `:hybrid` - transparently migrate existing `Marshal` cookie values to `JSON` (Requires Rails 4+) +* `CustomClass` - You can just pass the constant name of any class that responds to `.load` and `.dump` + +``` ruby +My::Application.config.session_store = :redis_session_store, { + # ... other options ... + serializer: :hybrid +} +``` + +**Note**: Rails 4 is required for using the `:json` and `:hybrid` serializers +because the `Flash` object doesn't serializer well in 3.2. See [Rails #13945](https://github.com/rails/rails/pull/13945) for more info. + +### Session load error handling + +If you want to handle cases where the session data cannot be loaded, a +custom callable handler may be provided as `on_session_load_error` which +will be given the error and the session ID. + +``` ruby +My::Application.config.session_store = :redis_session_store, { + # ... other options ... + on_session_load_error: ->(e, sid) { do_something_will_ya!(e) } +} +``` + +**Note** The session will *always* be destroyed when it cannot be loaded. + Contributing, Authors, & License -------------------------------- See [CONTRIBUTING.md](CONTRIBUTING.md), [AUTHORS.md](AUTHORS.md), and [LICENSE](LICENSE), respectively.