mailwolt/app/Support/CacheVer.php

29 lines
565 B
PHP

<?php
namespace App\Support;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
final class CacheVer
{
private const KEY = 'app:cache_v';
public static function get(): string
{
return (string) (Cache::get(self::KEY) ?? '1');
}
public static function bump(): string
{
$v = (string) Str::uuid(); // oder (int)+=1, UUID ist robust
Cache::forever(self::KEY, $v);
return $v;
}
public static function k(string $key): string
{
return 'v:'.self::get().':'.$key;
}
}