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