当前位置:网站首页>PHP returns false when calling redis method decrby less than 0
PHP returns false when calling redis method decrby less than 0
2022-06-26 12:25:00 【Yotoai Mengtian】
public function decr($key, $val = 1, $lessZero = false)
{
if ($lessZero) {
$luaScript = <<<LUA
if tonumber(redis.call("get", KEYS[1])) > 0 then
return redis.call('decrBy', KEYS[1], ARGV[1])
else
return false
end
LUA;
//
$res = $this->redis->eval($luaScript, [$key, $val], 1);
} else {
//
$res = $this->redis->decrBy($key, $val);
}
//
return $res;
}边栏推荐
- Comparison of latest mobile phone processors in 2020 (with mobile phone CPU ladder diagram)
- Leetcode 78. 子集 and 90. 子集 II
- Notice on printing and Distributing Measures for supporting strategic emerging industries and future industrial cluster development in Futian District, Shenzhen
- 2022 edition of investment analysis and "fourteenth five year plan" development prospect forecast report of China's switchgear industry
- Research on the current situation of China's modified engineering plastics market and demand forecast analysis report 2022-2028
- Quantitative elementary -- akshare obtains stock code, the simplest strategy
- 请指教同花顺是什么软件?在线开户安全么?
- [redis series] redis learning 16. Redis Dictionary (map) and its core coding structure
- NFS共享存储服务安装
- Demand scale forecast and investment competitiveness analysis report of China's new material market 2022-2028
猜你喜欢
![[solved] laravel completes the scheduled job task (delayed distribution task) [execute a user-defined task at a specified time]](/img/13/c2c63333a9e5ac08b339449ea17654.jpg)
[solved] laravel completes the scheduled job task (delayed distribution task) [execute a user-defined task at a specified time]

TSMC Samsung will mass produce 3nm chips in 2022: will the iPhone be the first?

Xiaolong 888 was released, Xiaomi 11 was launched, and 14 manufacturers carried it in the first batch!

Black squares in word

Spark-day01- get started quickly

Loggie encoding and newline character test

MySQL optimization - index (what is an index?)

International beauty industry giants bet on China

Vscode solves the problem of Chinese garbled code

Omni channel member link - tmall member link 3: preparation of member operation content
随机推荐
PolarisMesh系列文章——概念系列(一)
Rookie practical UML - activity diagram
Current situation investigation and investment prospect forecast analysis report of China's electrolytic copper market from 2022 to 2028
I want to know how the top ten securities firms open accounts? Is online account opening safe?
Consumer goods enterprises, four pain points of member marketing
证券账户一般需要在哪里开通 开户安全吗
Spark-day02-core programming-rdd
Statistical genetics: Chapter 2, the concept of statistical analysis
The best CMDB system
I'd like to know what preferential activities are available for stock account opening? Is it safe to open an account online?
On the use of protostaff [easy to understand]
Five strategies and suggestions of member marketing in consumer goods industry
Omnichannel membership - tmall membership 2: frequently asked questions
24 database interview questions that must be mastered!
Microservice governance (nocas)
[graduation season · advanced technology Er] I remember the year after graduation
China Medical Grade hydrogel market supply and demand research and prospect analysis report 2022 Edition
UDP protocol details [easy to understand]
fastjson的JSONArray和JSONObject[通俗易懂]
PHP laravel+gatewayworker completes im instant messaging and file transfer functions (Chapter 2: explanation of business logic)