Skip to content

Commit

Permalink
Ignore timers
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Oct 12, 2023
1 parent e02bfe4 commit b4065f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Recorders/CacheInteractions.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public function record(CacheHit|CacheMissed $event): ?Entry
{
$now = new CarbonImmutable();

if (Str::startsWith($event->key, ['illuminate:', 'laravel:pulse:'])) {
if (
Str::startsWith($event->key, ['illuminate:', 'laravel:pulse:']) ||
Str::endsWith($event->key, ':timer')
) {
return null;
}

Expand Down
8 changes: 8 additions & 0 deletions tests/Feature/CacheInteractionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
expect($interactions)->toHaveCount(0);
});

it('ignores internal illuminate timer interactions interactions', function () {
Cache::get('foo:timer');
Pulse::store(app(Ingest::class));

$interactions = Pulse::ignore(fn () => DB::table('pulse_cache_interactions')->get());
expect($interactions)->toHaveCount(0);
});

it('ignores internal pulse cache interactions', function () {
Cache::get('laravel:pulse:foo');
Pulse::store(app(Ingest::class));
Expand Down

0 comments on commit b4065f5

Please sign in to comment.