Class: EventSourcing::Aggregate::Manager::Cache
- Inherits:
-
Hash
- Object
- Hash
- EventSourcing::Aggregate::Manager::Cache
- Defined in:
- lib/event_sourcing/aggregate/manager/cache.rb
Instance Method Summary collapse
-
#initialize(event_bus) ⇒ Cache
constructor
A new instance of Cache.
- #instance_of(aggregate, id) ⇒ Object
Constructor Details
#initialize(event_bus) ⇒ Cache
Returns a new instance of Cache.
7 8 9 |
# File 'lib/event_sourcing/aggregate/manager/cache.rb', line 7 def initialize(event_bus) @event_bus = event_bus end |
Instance Method Details
#instance_of(aggregate, id) ⇒ Object
11 12 13 |
# File 'lib/event_sourcing/aggregate/manager/cache.rb', line 11 def instance_of(aggregate, id) self[id] ||= aggregate::Actor.spawn!(name: id, supervise: true, args: [@event_bus, @event_bus.get_stream(id)]) end |