Module: Philiprehberger::CacheKit::Serializable
- Included in:
- Store
- Defined in:
- lib/philiprehberger/cache_kit/serializable.rb
Overview
Snapshot and restore support for Store.
Instance Method Summary collapse
-
#restore(data) ⇒ void
Restore cache state from a previous snapshot.
-
#snapshot ⇒ Hash
Serialize current cache state for persistence.
Instance Method Details
#restore(data) ⇒ void
This method returns an undefined value.
Restore cache state from a previous snapshot.
18 19 20 |
# File 'lib/philiprehberger/cache_kit/serializable.rb', line 18 def restore(data) @mutex.synchronize { apply_snapshot(data) } end |
#snapshot ⇒ Hash
Serialize current cache state for persistence.
10 11 12 |
# File 'lib/philiprehberger/cache_kit/serializable.rb', line 10 def snapshot @mutex.synchronize { build_snapshot } end |