redis定期删除

redis定期删除

文档

  1. redis单机安装
  2. redis集群模式 -集群搭建
  3. redis大key问题-生成大key-生成100万条测试数据

官方文档

  1. 官网操作命令指南页面:https://redis.io/docs/latest/commands/?name=get&group=string
  2. Redis cluster specification

下载地址

  1. 官网:https://redis.io/
  2. 下载列表页面:https://download.redis.io/releases/

说明

  1. 版本选择:redis-7.0.0.tar.gz
  2. 下载地址:https://download.redis.io/releases/redis-7.0.0.tar.gz

redis定期删除

安装redis
  1. 以单机版redis为例,安装redis参考文档:redis单机安装
定期删除
  1. 在redis.conf中,找到ADVANCED CONFIG相关的配置

  2. 官方文档

    conf 复制代码
    ############################### ADVANCED CONFIG ###############################
    
    # (还有其它配置)
    
    # Redis calls an internal function to perform many background tasks, like
    # closing connections of clients in timeout, purging expired keys that are
    # never requested, and so forth.
    #
    # Not all tasks are performed with the same frequency, but Redis checks for
    # tasks to perform according to the specified "hz" value.
    #
    # By default "hz" is set to 10. Raising the value will use more CPU when
    # Redis is idle, but at the same time will make Redis more responsive when
    # there are many keys expiring at the same time, and timeouts may be
    # handled with more precision.
    #
    # The range is between 1 and 500, however a value over 100 is usually not
    # a good idea. Most users should use the default of 10 and raise this up to
    # 100 only in environments where very low latency is required.
    hz 10
  3. 中文翻译

    conf 复制代码
    ############################### ADVANCED CONFIG ###############################
    
    # Redis 调用内部函数来执行许多后台任务,例如
    # 关闭超时客户端的连接、清除从未被请求的过期键等等。
    #
    # 并非所有任务都以相同的频率执行,但 Redis 会根据指定的 "hz" 值
    # 来检查需要执行的任务。
    #
    # 默认情况下 "hz" 设置为 10。提高该值会在 Redis 空闲时使用更多 CPU,
    # 但同时,当有大量键同时过期时,Redis 会响应更快,
    # 并且可以更精确地处理超时。
    #
    # 取值范围在 1 到 500 之间,但通常不建议超过 100。
    # 大多数用户应该使用默认值 10,只有在需要极低延迟的环境中
    # 才将其提高到 100。
    
    hz 10

参考资料

  1. https://www.bilibili.com/video/BV13R4y1v7sP

注意事项

  1. 部分内容由AI生成
  2. 如有不对,欢迎指正!!!
相关推荐
没有气的汽水1 小时前
一次生产 Redis 内存打满的排查、清理和复盘
redis
hey you~2 小时前
云呼叫中心坐席自动分配实战:ACD 策略、Redis+Lua 实现与排查清单
数据库·redis·lua·云呼叫中心·acd·坐席分配·坐席状态机
我不会起名字3223 小时前
Redis pipeline 用了反而更慢:3 类误用与正确的批量姿势
redis·pipeline·lua·rtt·批量
Tsuki_tl3 小时前
【总结】Redis五大数据类型应用场景及基本命令
数据库·redis·后端·缓存·缓存中间件·redis命令·redis 五大数据类型
代码丰18 小时前
大 JSON 放进 Redis 之后,如何用 Stream 解耦耗时任务?
redis·后端·系统架构
枫子有风1 天前
卡码网盘项目深挖
java·redis·jwt·es·pgvector
福大大架构师每日一题1 天前
redis 8.10.3正式发布:聚焦集群总线超大消息传播场景的安全修复,8.10.3 Latest更新解读
数据库·redis·安全
江屿风1 天前
【Plain Language Large Model】【从麦当劳点餐到Redis接入:MCP如何让AI工具集成变简单】流食般投喂
人工智能·redis·笔记·语言模型·llm·mcp
码智社1 天前
Redis 哨兵模式详解:从原理到生产实践
java·redis
与数据交流的路上1 天前
一次 redis 幽灵内存的分析
数据库·redis·缓存