Files
ntspi-app/app/Services/App/Cache/AbstractCacheService.php
T
F4ilji 2d101dcdda feat: Refactor MainController and related tasks to follow Porto architecture
- Moved logic from MainController to dedicated action and task classes.
- Introduced GetMainPageDataAction, GetEducationsDataTask, GetRecentPostsTask, GetUpcomingEventsTask, and GetPageDataTask for better separation of concerns.
- Updated routes to use the new MainController from the Main container.
- Deprecated the old MainController with a clear message for future removal.
- Updated caching mechanisms to use the new task classes.
- Adjusted environment variable access to use config() instead of env() for better practice.
- Added new MainPageResource for structured data response.
- Updated .gitignore to exclude QWEN.md.
- Added Jenkins service to docker-compose for CI/CD integration.
2025-12-16 12:20:01 +05:00

27 lines
784 B
PHP

<?php
namespace App\Services\App\Cache;
use Illuminate\Support\Facades\Redis;
abstract class AbstractCacheService
{
public function clearCacheByPrefix(string $prefix): void
{
// Получаем префикс из .env
$redisPrefix = config('database.redis.options.prefix', 'ntspi');
// Получаем ключи, соответствующие префиксу
$keys = Redis::keys($prefix);
if (!empty($keys)) {
foreach ($keys as $key) {
// Убираем префикс и двоеточие из ключа
$cleanedKey = str_replace([$redisPrefix, ':'], '', $key);
// Удаляем ключ
Redis::del($cleanedKey);
}
}
}
}