<?php

namespace App\Listeners;

use App\Cache\CategoryTreeCache;
use App\Events\Admin\CategoryUpdated;
use App\Events\Admin\NewCategory;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class RefreshCategoryCache
{
    /**
     * Create the event listener.
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     */
    public function handle(CategoryUpdated|NewCategory $event): void
    {
        cacheable(CategoryTreeCache::class)->refresh();
    }
}
