当前位置:网站首页>Setnx command execution failed due to full redis memory
Setnx command execution failed due to full redis memory
2022-04-23 09:32:00 【Notes of Pan Guangyu de Xiaobai】
One 、 Problem occurs
Under normal circumstances , adopt setnx Set a lock , It should be 1s After expired ( Prevent concurrent requests , Handle the same logic ), But what actually happened was , Deal with the following logic for the first time , Throw an exception . explain setnx Function returned false.
$redis_key_lock = 'lock';
//@todo Set up a 1s Lock of
$lock = $redis->setnx($redis_key_lock, 1);
//@todo Will be locked in 1s After expired
$redis->expire($redis_key_lock, 1);
if ($lock) {
// Perform other logic
} else {
throw new \Exception(" Lock present ");
}
Two 、 Troubleshoot problems
redis Your memory is full

adopt redis.conf Check it out. redis Expiration strategy
# maxmemory-policy volatile-lru
explain redis The default expiration policy is used noeviction
Default expiration policy noeviction Not for expired keys Do any cleaning , When the memory is full , Will refuse to perform all write operations , By flipping through redis The configuration file , You can find relevant tips , And in addition to setnx, Other write operation related instructions , Will fail .

The solution is to quickly release redis Memory , Give Way setnx The command can be executed normally .
版权声明
本文为[Notes of Pan Guangyu de Xiaobai]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230929494125.html
边栏推荐
- Simple understanding of arguments in JS
- 三、6【Verilog HDL】基础知识之门级建模
- web页面如何渲染
- Kettle experiment (III)
- Kettle实验
- JSON input of Chapter 14 of kettle paoding jieniu
- Go language learning notes - structure | go language from scratch
- Amazon cloud technology entry Resource Center, easy access to the cloud from 0 to 1
- Base de la technologie électronique numérique 3.1 aperçu du circuit de porte, 3.2 circuit de porte à diode semi - conductrice
- Leetcode0587. 安装栅栏(difficult)
猜你喜欢

亚马逊云科技入门资源中心,从0到1轻松上云

Kettle experiment (III)
![[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)](/img/a2/b50fadad859a050eecfa15a436e126.png)
[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)

Cross domain configuration error: when allowcredentials is true, allowedorigins cannot contain the special value "*“

EmuElec 编译总结

A must see wechat applet development guide 1 - basic knowledge

High paid programmer & interview question series 91 limit 20000 loading is very slow. How to solve it? How to locate slow SQL?

机器学习(六)——贝叶斯分类器

Kettle experiment

Kettle实验 转换案例
随机推荐
《数字电子技术基础》3.1 门电路概述、3.2 半导体二极管门电路
机器学习(六)——贝叶斯分类器
node安装
Pre parsing of JS
Flink SQL realizes the integration of stream and batch
DVWA range practice
Give the method of instantiating the object to the new object
JS node operation, why learn node operation
Two declaration methods of functions of JS
错题汇总1
MySQL - Chapter 1 (data type 2)
JS case to find the maximum value, reverse the array, bubble sort
How to protect open source projects from supply chain attacks - Security Design (1)
3、 6 [Verilog HDL] gate level modeling of basic knowledge
web页面如何渲染
GUI, CLI and UNIX Philosophy
Thread scheduling (priority)
Learn FPGA (from Verilog to HLS)
How to render web pages
JS DOM learn three ways to create elements