Докинул к 719eb1403f

This commit is contained in:
brusnitsyn
2026-04-22 20:36:24 +09:00
parent 719eb1403f
commit 1de9fd3ef8
3 changed files with 213 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Services\Cache;
use Illuminate\Support\Facades\Cache;
class CacheInvalidator
{
public function forget(array $keys): void
{
foreach ($keys as $key) {
Cache::forget($key);
}
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Services\Cache;
class CacheKeyBuilder
{
public function __construct(
private readonly string $version = 'v1'
) {}
public function make(string $key, array $parts = []): string
{
$suffix = empty($parts) ? '' : ':' . implode(':', array_map(static fn ($part) => (string) $part, $parts));
return "{$this->version}:{$key}{$suffix}";
}
}