* [refac] refactor configuration of result caches.

This commit is contained in:
liugang
2024-11-20 15:42:49 +08:00
committed by 朱金勇
parent 8254d103e1
commit 34575a5f90
+7 -7
View File
@@ -22,16 +22,16 @@ $config->redis->cache->raw[TABLE_RELEASE] = 'id';
$config->redis->cache->raw[TABLE_USER] = 'account';
$config->redis->cache->res = [];
$config->redis->cache->res['module'][] = ['key' => 'CACHE_MODULE_TREE', 'params' => ['type', 'root', 'branch']];
$config->redis->cache->res[TABLE_MODULE][] = ['name' => 'CACHE_MODULE_TREE', 'fields' => ['type', 'root', 'branch']];
$config->redis->cache->res['user'][] = ['key' => 'CACHE_USER_PAIRS'];
foreach($config->redis->cache->res as $module => $caches)
$config->cache->keys = [];
foreach($config->redis->cache->res as $table => $caches)
{
foreach($caches as $cache)
{
$key = $cache['key'];
$value = str_replace('_', ':', strtolower($cache['key']));
define($key, $value);
$cache = (object)$cache;
$cache->table = $table;
$config->cache->keys[$cache->name] = $cache;
define($cache->name, $cache->name);
}
}