Class: Synapse::EventSourcing::CacheClearingUnitOfWorkListener Private
- Inherits:
-
UnitOfWork::UnitOfWorkListener
- Object
- UnitOfWork::UnitOfWorkListener
- Synapse::EventSourcing::CacheClearingUnitOfWorkListener
- Defined in:
- lib/synapse/event_sourcing/caching.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Listener that removes an aggregate from the cache if the unit of work is rolled back
Instance Method Summary collapse
- #initialize(aggregate_id, cache) ⇒ undefined constructor private
- #on_rollback(unit, cause = nil) ⇒ undefined private
Methods inherited from UnitOfWork::UnitOfWorkListener
#after_commit, #on_cleanup, #on_event_registered, #on_prepare_commit, #on_prepare_transaction_commit, #on_start
Constructor Details
#initialize(aggregate_id, cache) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 56 |
# File 'lib/synapse/event_sourcing/caching.rb', line 53 def initialize(aggregate_id, cache) @aggregate_id = aggregate_id @cache = cache end |
Instance Method Details
#on_rollback(unit, cause = nil) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 |
# File 'lib/synapse/event_sourcing/caching.rb', line 61 def on_rollback(unit, cause = nil) @cache.delete @aggregate_id end |