class EventSourcing::Aggregate::Manager::Cache

Public Class Methods

new(event_bus) click to toggle source
# File lib/event_sourcing/aggregate/manager/cache.rb, line 7
def initialize(event_bus)
  @event_bus = event_bus
end

Public Instance Methods

instance_of(aggregate, id) click to toggle source
# 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