Files
ntspi-app/app/Services/App/Cache/SliderCacheService.php
T
F4ilji c01016a154 Migrate backend to Porto architecture and fix minor bugs
- Fully transitioned the backend to the Porto architectural pattern
- Improved code organization and maintainability
- Fixed minor bugs and inconsistencies
2025-05-12 08:47:43 +05:00

36 lines
797 B
PHP

<?php
namespace App\Services\App\Cache;
use App\Ship\Enums\CacheKeys;
use Illuminate\Support\Facades\Cache;
class SliderCacheService extends AbstractCacheService implements CacheInterface
{
private const DEFAULT_TTL = 3600;
public function clearCache($entity): void
{
$this->clearAllCacheByModel();
}
public function clearAllCacheByModel(): void
{
$this->clearSliderCache();
}
public function getCachedData(string $key)
{
return Cache::get($key);
}
public function cacheData(string $key, $data, int $ttl = null): void
{
Cache::put($key, $data, $ttl ?? self::DEFAULT_TTL);
}
private function clearSliderCache(): void
{
$this->clearCacheByPrefix(CacheKeys::SLIDER_PREFIX->value.'*');
}
}