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
176 177 178 179 180 181 182 |
# File 'lib/redis-session-store.rb', line 176 def self.load(value) if needs_migration?(value) Marshal.load(value) else super end end |
.needs_migration?(value) ⇒ Boolean
184 185 186 |
# File 'lib/redis-session-store.rb', line 184 def self.needs_migration?(value) value.start_with?(MARSHAL_SIGNATURE) end |