<?php

namespace App\Services;

use Illuminate\Support\Facades\Cache;

class ContentCacheService
{
    public const TAG = 'nh_trans_public_content';

    public function remember(string $key, callable $callback): mixed
    {
        return Cache::remember(self::TAG.':'.$key, now()->addMinutes(30), $callback);
    }

    public function flush(): void
    {
        $store = Cache::getStore();

        if (method_exists($store, 'flush')) {
            Cache::flush();
        }
    }
}
