redis HSET 设置值异常:

栏目: 编程语言 · PHP · Redis · 发布时间: 9年前

内容简介:redis HSET 设置值异常:"\x00\x00\x00\x02\x06\x00"

在 PHP 代码中 hset 设置 redis 值异常

$redis->hset($key, $field, 0);
$redis->hincrby($key, $field, 1); // 返回false

linux 终端查看 redis 值,发现值异常:

redis 192.168.1.123:7806> HGET group_unread_msg_30812732 92952
"\x00\x00\x00\x02\x06\x00"
redis 192.168.1.123:7806> HINCRBY group_unread_msg_30812732 92952 1
(error) ERR hash value is not an integer

不知道为什么 PHP 使用 hset 设置时,redis 值会出现异常。

解决方法:

$redis->hset($key, $field, 0);

改为

$redis->del($key);

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Boolean Reasoning

Boolean Reasoning

Brown, Frank Markham / 2003-4 / $ 19.15

A systematic treatment of Boolean reasoning, this concise, newly revised edition combines the works of early logicians with recent investigations, including previously unpublished research results. Th......一起来看看 《Boolean Reasoning》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

MD5 加密
MD5 加密

MD5 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具