Compare commits

..

3 Commits
2.8.6 ... 2.8.7

Author SHA1 Message Date
Wang
9d1952f5f8 add bool type support for LightCache (#325) 2023-03-03 21:58:40 +08:00
Jerry
6543574695 update version to 2.8.7 2023-02-13 21:04:01 +08:00
Wang
5b1c771a2d 为键名使用强制类型转换string
使用数字作为键名时set()成功保存 但是停止框架后再启动框架数据落地恢复时报错类型不符合
Fatal error: Uncaught TypeError: Swoole\Table::set(): Argument #1 ($key) must be of type string, int given in zhamao/vendor/zhamao/framework/src/ZM/Store/LightCache.php:81
2023-02-13 21:04:01 +08:00
2 changed files with 6 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ class ConsoleApplication extends Application
{
public const VERSION_ID = 480;
public const VERSION = '2.8.6';
public const VERSION = '2.8.7';
private static $obj;

View File

@@ -75,7 +75,7 @@ class LightCache
} else {
return false;
}
$result = self::$kv_table->set($k, [
$result = self::$kv_table->set((string)$k, [
'value' => $value,
'expire' => $v['expire'],
'data_type' => $data_type,
@@ -188,7 +188,10 @@ class LightCache
$data_type = '';
} elseif (is_int($value)) {
$data_type = 'int';
} else {
} elseif (is_bool($value)) {
$data_type = 'bool';
$value = json_encode($value);
} else {
throw new LightCacheException('E00048', 'Only can set string, array and int');
}
try {