cache_redis

package module
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 8 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

cache-redis

cache-redis 是 github.com/infrago/cache 的redis 驱动。

包定位

  • 类型:驱动
  • 作用:把 cache 模块的统一接口落到 redis 后端实现

快速接入

import (
    _ "github.com/infrago/cache"
    _ "github.com/infrago/cache-redis"
)
[cache]
driver = "redis"

[cache.setting]
addr = "127.0.0.1:6379"
timeout = "3s"
unlink = true

setting 专用配置项

配置位置:[cache].setting

  • server
  • addr
  • username
  • password
  • database
  • timeout:单条 Redis 命令超时时间,默认 3s
  • unlink:Clear 批量删除时使用 UNLINK,默认 false 使用 DEL

说明

  • setting 仅对当前驱动生效,不同驱动键名可能不同
  • 连接失败时优先核对 setting 中 host/port/认证/超时等参数
  • Keys / Clear 使用 SCAN 分批扫描;这仍然是管理操作,不建议放在高频业务路径
  • 驱动实现了 SequenceMany,批量取号会使用 Redis Lua 脚本原子完成

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址