refactor: loadCacheValue/saveCacheValue (#4205)

This commit is contained in:
Dag 2024-08-08 17:47:04 +02:00 committed by GitHub
parent 2acd415475
commit f358f1abec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 188 additions and 158 deletions

View file

@ -322,16 +322,14 @@ abstract class BridgeAbstract
return null;
}
protected function loadCacheValue(string $key)
protected function loadCacheValue(string $key, $default = null)
{
$cacheKey = $this->getShortName() . '_' . $key;
return $this->cache->get($cacheKey);
return $this->cache->get($this->getShortName() . '_' . $key, $default);
}
protected function saveCacheValue(string $key, $value, $ttl = 86400)
protected function saveCacheValue(string $key, $value, int $ttl = null)
{
$cacheKey = $this->getShortName() . '_' . $key;
$this->cache->set($cacheKey, $value, $ttl);
$this->cache->set($this->getShortName() . '_' . $key, $value, $ttl);
}
public function getShortName(): string