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
215 216 217 218 219 220 221 |
# File 'lib/redis-session-store.rb', line 215 def self.load(value) if needs_migration?(value) Marshal.load(value) else super end end |
.needs_migration?(value) ⇒ Boolean
223 224 225 |
# File 'lib/redis-session-store.rb', line 223 def self.needs_migration?(value) value.start_with?(MARSHAL_SIGNATURE) end |