Redis
5/14/25Less than 1 minutecomponentredis
Redis Usage Example
goredis
is a Redis client packaged based on go-redis/v9, supporting multiple modes such as Redis master-replica, sentinel, and cluster.
Click to view Redis Usage Example.
Redis Configuration
Set the redis
field in the YAML file under the configs
directory, supporting setting sentinel and cluster:
redis:
# dsn format: [user]:<pass>@127.0.0.1:6379/[db], default user is default, user is supported in Redis 6.0 and above.
dsn: "default:123456@127.0.0.1:6379/0"
dialTimeout: 10 # Dial timeout, unit (seconds)
readTimeout: 2 # Read timeout, unit (seconds)
writeTimeout: 2 # Write timeout, unit (seconds)
# sentinelAddrs: ["127.0.0.1:6379", "127.0.0.1:6380"]
# clusterAddrs: ["127.0.0.1:6379", "127.0.0.1:6380"]