本文基于
redis_version:6.2.5
用法
修改del命令的默认行为,使之与unlink命令一毛一样
lazyfree-lazy-user-del yes
注意事项:
-
lazyfree-lazy-user-del支持yes或者no。默认是no。 - 如果设置为
yes,那么del命令就等价于unlink,也是非阻塞删除。
源码实现
redis_del_lazyfree-lazy-user-del.png
del与unlink命令底层均调用delGenericCommand方法,区别是unlink第二个参数传的是1,del传的是lazyfree-lazy-user-del,所以如果lazyfree-lazy-user-del配置的是yes的话,那么del命令的功能就等价于unlink。
原生注释
# 翻译概要:将代码中的del替换成unlink可能不是那么太容易,所以为了让del
# 命令的实际效果等价于unlink,你可以修改配置文件为lazyfree-lazy-user-del yes
#
# It is also possible, for the case when to replace the user code DEL calls
# with UNLINK calls is not easy, to modify the default behavior of the DEL
# command to act exactly like UNLINK, using the following configuration
# directive:
lazyfree-lazy-user-del no
本文属于原创,首发于微信公众号【小易哥学呀学】,如需转载请后台留言。








网友评论