DWQA QuestionsCategory: DatabaseIs there no decrbyflot method in PHP redis extension?
Aries asked 2 months ago

When it comes to a user’s balance, the format is 10.00, with two decimal places reserved.
The incrbyflot method is used when adding
But it can’t be reduced. Can we just read it first, subtract it, and then set it?

2 Answers
You Ming answered 2 months ago

incrByFloat($key, -10.00);

Aries replied 2 months ago

3q, didn’t turn around

Xixi Dad replied 2 months ago


Daewoo answered 2 months ago

Not PHP plug-in, not..
In essence, redis does not have the command decrbyflot
Incr: add 1
Decr: minus 1
incrby xx num:xx Add num
decrby xx num:xx Reduce num
Incrbyflot XX num (float type): XX increases num
But there is no decrbyflot instruction~~~~