Class: RedisSessionStore::HybridSerializer
- Inherits:
-
JsonSerializer
- Object
- JsonSerializer
- RedisSessionStore::HybridSerializer
- Defined in:
- lib/redis-session-store.rb
Overview
Transparently migrates existing session values from Marshal to JSON
Constant Summary collapse
- MARSHAL_SIGNATURE =
"\x04\x08".freeze
Class Method Summary collapse
Methods inherited from JsonSerializer
Class Method Details
.load(value) ⇒ Object
196 197 198 199 200 201 202 |
# File 'lib/redis-session-store.rb', line 196 def self.load(value) if needs_migration?(value) Marshal.load(value) else super end end |
.needs_migration?(value) ⇒ Boolean
204 205 206 |
# File 'lib/redis-session-store.rb', line 204 def self.needs_migration?(value) value.start_with?(MARSHAL_SIGNATURE) end |