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
207 208 209 210 211 212 213 |
# File 'lib/redis-session-store.rb', line 207 def self.load(value) if needs_migration?(value) Marshal.load(value) else super end end |
.needs_migration?(value) ⇒ Boolean
215 216 217 |
# File 'lib/redis-session-store.rb', line 215 def self.needs_migration?(value) value.start_with?(MARSHAL_SIGNATURE) end |