mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 14:25:38 +08:00
update global functions for KV
This commit is contained in:
@@ -248,11 +248,12 @@ function bot(): ZM\Context\BotContext
|
||||
return new \ZM\Context\BotContext('', '');
|
||||
}
|
||||
|
||||
function kv(string $name = ''): KVInterface
|
||||
function kv(string $name = ''): Psr\SimpleCache\CacheInterface
|
||||
{
|
||||
global $kv_class;
|
||||
if (!$kv_class) {
|
||||
$kv_class = config('global.kv.use', \LightCache::class);
|
||||
}
|
||||
return $kv_class::open($name);
|
||||
/* @phpstan-ignore-next-line */
|
||||
return is_a($kv_class, KVInterface::class, true) ? $kv_class::open($name) : new $kv_class($name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user