发布推送
This commit is contained in:
21
app/Cache/Base/StructBaseCache.php
Normal file
21
app/Cache/Base/StructBaseCache.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cache\Base;
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
//用户缓存用户基础信息(结构自己组装)uid为主键
|
||||
abstract class StructBaseCache extends BaseCache
|
||||
{
|
||||
public string $primary_key_column = 'uid'; //值标识
|
||||
public array $aCacheKey = [];
|
||||
function loadData(): array|null
|
||||
{
|
||||
$aData = [];
|
||||
foreach ($this->aCacheKey as $key => $value) {
|
||||
if (method_exists($this, $value)) $aData[$key] = $this->$value();
|
||||
}
|
||||
return $aData;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user