Skip to content

Commit 8a0778d

Browse files
authored
Merge pull request #246 from patchlevel/rebuild-cache-pool
make cache pool configurable in rebuild after file change
2 parents 961d6cd + a5a11f6 commit 8a0778d

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

docs/pages/configuration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ patchlevel_event_sourcing:
411411

412412
This works only before each http requests and not if you use the console commands.
413413

414+
!!! tip
415+
416+
This is using the cache system to store the latest file change time. You can change the cache pool with the `cache_pool` option.
417+
414418
## Command Bus
415419

416420
You can also enable and register our handlers in symfony messenger.

src/DependencyInjection/Configuration.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* ids: list<string>,
2727
* groups: list<string>,
2828
* },
29-
* rebuild_after_file_change: bool
29+
* rebuild_after_file_change: array{enabled: bool, cache_pool: string}
3030
* },
3131
* connection: ?array{
3232
* service: ?string,
@@ -220,7 +220,13 @@ public function getConfigTreeBuilder(): TreeBuilder
220220
->end()
221221
->end()
222222

223-
->booleanNode('rebuild_after_file_change')->defaultFalse()->end()
223+
->arrayNode('rebuild_after_file_change')
224+
->canBeEnabled()
225+
->addDefaultsIfNotSet()
226+
->children()
227+
->scalarNode('cache_pool')->defaultValue('cache.app')->end()
228+
->end()
229+
->end()
224230
->end()
225231
->end()
226232

src/DependencyInjection/PatchlevelEventSourcingExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,15 +429,15 @@ static function (ChildDefinition $definition): void {
429429
]);
430430
}
431431

432-
if (!$config['subscription']['rebuild_after_file_change']) {
432+
if (!$config['subscription']['rebuild_after_file_change']['enabled']) {
433433
return;
434434
}
435435

436436
$container->register(SubscriptionRebuildAfterFileChangeListener::class)
437437
->setArguments([
438438
new Reference(SubscriptionEngine::class),
439439
new TaggedIteratorArgument('event_sourcing.subscriber'),
440-
new Reference('cache.app'),
440+
new Reference($config['subscription']['rebuild_after_file_change']['cache_pool']),
441441
new Reference(SubscriberMetadataFactory::class),
442442
])
443443
->addTag('kernel.event_listener', [

0 commit comments

Comments
 (0)