This commit is contained in:
pomjay
2025-06-25 09:35:09 +08:00
parent 81a95f47a0
commit 7e3eba92e2
16 changed files with 154 additions and 44 deletions

View File

@ -29,6 +29,7 @@ abstract class BaseCache
{
$sCacheKey = $this->getPrimaryKey();
$aData = $this->loadData();
if (empty($aData)) return false;
return Cache::put($sCacheKey, $aData, self::CACHE_TTL);
}
@ -46,12 +47,14 @@ abstract class BaseCache
function getCacheData($primary_key = null): array|string|null
{
if ($primary_key === null) $primary_key = $this->primary_key;
if (empty($primary_key)) return [];
$sCacheKey = $this->getPrimaryKey($primary_key);
$sData = Cache::get($sCacheKey);
if (empty($sData)) {
$this->primary_key = $primary_key;
if ($this->loadToCache()) $sData = Cache::get($sCacheKey);
}
if (empty($sData)) return null;