Skip to content

Commit

Permalink
Merge pull request #25 from mitydigital/feature/scheduled-cache-inval…
Browse files Browse the repository at this point in the history
…idator

Listen for ScheduledCacheInvalidated event
  • Loading branch information
martyf authored Aug 28, 2024
2 parents 9f2f78d + e87bdc4 commit a88bd14
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Listeners/ScheduledCacheInvalidated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace MityDigital\Sitemapamic\Listeners;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Cache;
use MityDigital\Sitemapamic\Commands\ClearSitemapamicCacheCommand;
use Statamic\Events\EntrySaved;

class ScheduledCacheInvalidated implements ShouldQueue
{
public function handle(\MityDigital\StatamicScheduledCacheInvalidator\Events\ScheduledCacheInvalidated $event) {
Artisan::call(ClearSitemapamicCacheCommand::class);
}
}
4 changes: 4 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use MityDigital\Sitemapamic\Commands\ListSitemapamicCacheKeysCommand;
use MityDigital\Sitemapamic\Listeners\ClearSitemapamicCache;
use MityDigital\Sitemapamic\Commands\ClearSitemapamicCacheCommand;
use MityDigital\Sitemapamic\Listeners\ScheduledCacheInvalidated;
use Statamic\Events\CollectionDeleted;
use Statamic\Events\CollectionSaved;
use Statamic\Events\EntryDeleted;
Expand Down Expand Up @@ -53,6 +54,9 @@ class ServiceProvider extends AddonServiceProvider
TermSaved::class => [
ClearSitemapamicCache::class,
],
\MityDigital\StatamicScheduledCacheInvalidator\Events\ScheduledCacheInvalidated::class => [
ScheduledCacheInvalidated::class
]
];

protected $updateScripts = [
Expand Down

0 comments on commit a88bd14

Please sign in to comment.