Rework admin panel and other

This commit is contained in:
F4ilji
2025-04-02 18:37:20 +05:00
parent 49072e50c7
commit 5cd6ff11b5
198 changed files with 9715 additions and 6664 deletions
@@ -2,43 +2,36 @@
namespace App\Services\App\Cache;
use App\Enums\CacheKeys;
use Illuminate\Support\Facades\Cache;
class MainSectionCacheService extends AbstractCacheService implements CacheInterface
{
/**
* Очищает кеш, связанный с постом.
*
* @param mixed $entity Пост или связанная сущность
* @return void
*/
private const DEFAULT_TTL = 3600;
public function clearCache($entity): void
{
$this->clearCacheByPrefix('posts_');
$this->clearNavigationCache();
}
public function clearAllCacheByModel(): void
{
$this->clearNavigationCache();
}
/**
* Получает кешированные данные по ключу.
*
* @param string $key Ключ кеша
* @return mixed
*/
public function getCachedData(string $key)
{
return Cache::get($key);
}
/**
* Кеширует данные по ключу.
*
* @param string $key Ключ кеша
* @param mixed $data Данные для кеширования
* @param int $ttl Время жизни кеша в секундах
* @return void
*/
public function cacheData(string $key, $data, int $ttl = 3600): void
public function cacheData(string $key, $data, int $ttl = null): void
{
Cache::put($key, $data, $ttl);
Cache::put($key, $data, $ttl ?? self::DEFAULT_TTL);
}
private function clearNavigationCache(): void
{
Cache::forget(CacheKeys::NAVIGATION_PREFIX->value);
}
}