<?php

namespace App\Observers;

use Illuminate\Support\Facades\Cache;

class ClearsSitemapCacheObserver
{
    public function saved(object $model): void
    {
        $this->forget();
    }

    public function deleted(object $model): void
    {
        $this->forget();
    }

    protected function forget(): void
    {
        Cache::forget(config('hillcrest.cache.sitemap_key'));
    }
}
