- handleCaching now supports an array of string (which will be glued together)
This commit is contained in:
parent
8665e97a19
commit
43c0627319
@ -8,10 +8,14 @@ trait HandleCacheTrait
|
||||
{
|
||||
protected ? CacheInterface $cache;
|
||||
|
||||
protected function handleCaching(string $key, callable $callback, null|int|\DateInterval $ttl = null) : mixed
|
||||
protected function handleCaching(string|array $key, callable $callback, null|int|\DateInterval $ttl = null) : mixed
|
||||
{
|
||||
static $internalCache = [];
|
||||
|
||||
if (is_array($key)) {
|
||||
$key = implode('.', $key);
|
||||
}
|
||||
|
||||
if ( isset($internalCache[$key]) ) {
|
||||
return $internalCache[$key];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user