The first time the request is made, Hgetall count_comment
returns 58
, and then hincrBy +1
, the hGetAll
expected return is count_comment
59
turned 1
. The expected incremental effect is not achieved.
Executing the same request again, Hgetall returns count_comment
1
, and then returns it again hincrBy +1
hGetAll
count_comment
2
. This request hincrBy +1
is an expected increment of the implementation.
It is not clear what is the cause of the situation, for a long time did not find the reason.
Here is redis
used phpredis
to connect
count_comment
are all string types.
Reply content:
The first time the request is made, Hgetall count_comment
returns 58
, and then hincrBy +1
, the hGetAll
expected return is count_comment
59
turned 1
. The expected incremental effect is not achieved.
Executing the same request again, Hgetall returns count_comment
1
, and then returns it again hincrBy +1
hGetAll
count_comment
2
. This request hincrBy +1
is an expected increment of the implementation.
It is not clear what is the cause of the situation, for a long time did not find the reason.
Here is redis
used phpredis
to connect
count_comment
are all string types.
I found a problem.
This is expected, you can ' t run INCR, Incrby, or Hincrby on serialized
data.
When you initialize Redis, you are using the SERIALIZER
format store
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);