mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-20 23:25:35 +08:00
update to 2.2.5 version
add saveToJson and loadFromJson function for DataProvider.php fix @OnSave annotation not working adjust swoole timer tick add hasKey() for WorkerCache.php
This commit is contained in:
@@ -39,6 +39,16 @@ class WorkerCache
|
||||
}
|
||||
}
|
||||
|
||||
public static function hasKey($key, $subkey) {
|
||||
$config = self::$config ?? ZMConfig::get("global", "worker_cache") ?? ["worker" => 0];
|
||||
if ($config["worker"] === server()->worker_id) {
|
||||
return isset(self::$store[$key][$subkey]);
|
||||
} else {
|
||||
$action = ["hasKeyWorkerCache", "key" => $key, "subkey" => $subkey, "cid" => zm_cid()];
|
||||
return self::processRemote($action, false, $config);
|
||||
}
|
||||
}
|
||||
|
||||
private static function processRemote($action, $async, $config) {
|
||||
$ss = server()->sendMessage(json_encode($action, JSON_UNESCAPED_UNICODE), $config["worker"]);
|
||||
if (!$ss) return false;
|
||||
|
||||
Reference in New Issue
Block a user