FlushSubgraphCachePoolCatchUpHook
final class FlushSubgraphCachePoolCatchUpHook implements CatchUpHookInterface (View source)
| internal |
Ensures that the {SubgraphCachePool} is flushed always when content changes. This CatchUpHook is triggered when projections change.
Implementation note:
- We could flush the cache also on each 'onAfterEvent' but for that this catchup hook must be guaranteed to be invoked first, and currently there is no sorting for 'catchUpHooks'
- Also flushing in a catchup hook only works because this hook and the catchup is executed synchronously. A future async catchup must be flushed instead via a custom command hook instead
Methods
This hook is called at the beginning of a catch-up run, after the database lock is acquired, but before any projection was called.
This hook is called for every event during the catchup process, before the projection is updated but in the same transaction.
This hook is called for every event during the catchup process, after the projection is updated but in the same transaction,
This hook is called for each batch of processed events during the catchup process, after the projection and their new position is updated and the transaction is commited.
This hook is called at the END of a catch-up run, after the projection and their new position is updated and the transaction is commited.
Details
__construct(SubgraphCachePool $subgraphCachePool)
No description
void
onBeforeCatchUp(SubscriptionStatus $subscriptionStatus)
This hook is called at the beginning of a catch-up run, after the database lock is acquired, but before any projection was called.
Note that any errors thrown will be collected and the current catchup batch will be finished as normal. The collect errors will be returned and rethrown by the content repository.
void
onBeforeEvent(EventInterface $eventInstance, EventEnvelope $eventEnvelope)
This hook is called for every event during the catchup process, before the projection is updated but in the same transaction.
Note that any errors thrown will be collected and the current catchup batch will be finished as normal. The collect errors will be returned and rethrown by the content repository.
void
onAfterEvent(EventInterface $eventInstance, EventEnvelope $eventEnvelope)
This hook is called for every event during the catchup process, after the projection is updated but in the same transaction,
Note that any errors thrown will be collected and the current catchup batch will be finished as normal. The collect errors will be returned and rethrown by the content repository.
void
onAfterBatchCompleted()
This hook is called for each batch of processed events during the catchup process, after the projection and their new position is updated and the transaction is commited.
The database lock is directly acquired again after it is released if the batching needs to continue. It can happen that this method is called even without having seen events in the meantime.
Note that any errors thrown will be collected but no further batch is started. The collect errors will be returned and rethrown by the content repository.
void
onAfterCatchUp()
This hook is called at the END of a catch-up run, after the projection and their new position is updated and the transaction is commited.
Note that any errors thrown will be collected and the catchup will finish as normal. The collect errors will be returned and rethrown by the content repository.