@@ -62,20 +62,35 @@ const (
62
62
lockRefreshInterval = 3 * time .Second
63
63
)
64
64
65
- // RedisStorage implements Redis storage plugin functionality for Caddy.
66
- // It supports connecting to standalone , Cluster, or Sentinal (Failover) Redis servers .
65
+ // RedisStorage implements a Caddy storage backend for Redis
66
+ // It supports Single (Standalone) , Cluster, or Sentinal (Failover) Redis server configurations .
67
67
type RedisStorage struct {
68
+ // ClientType specifies the Redis client type. Valid values are "cluster" or "failover"
68
69
ClientType string `json:"client_type"`
70
+ // Address The full address of the Redis server. Example: "127.0.0.1:6379"
71
+ // If not defined, will be generated from Host and Port parameters.
69
72
Address []string `json:"address"`
73
+ // Host The Redis server hostname or IP address. Default: "127.0.0.1"
70
74
Host []string `json:"host"`
75
+ // Host The Redis server port number. Default: "6379"
71
76
Port []string `json:"port"`
77
+ // DB The Redis server database number. Default: 0
72
78
DB int `json:"db"`
79
+ // Timeout The Redis server timeout in seconds. Default: 5
73
80
Timeout string `json:"timeout"`
81
+ // Username The username for authenticating with the Redis server. Default: "" (No authentication)
74
82
Username string `json:"username"`
83
+ // Password The password for authenticating with the Redis server. Default: "" (No authentication)
75
84
Password string `json:"password"`
85
+ // MasterName Only required when connecting to Redis via Sentinal (Failover mode). Default ""
76
86
MasterName string `json:"master_name"`
87
+ // KeyPrefix A string prefix that is appended to Redis keys. Default: "caddy"
88
+ // Useful when the Redis server is used by multiple applications.
77
89
KeyPrefix string `json:"key_prefix"`
90
+ // EncryptionKey A key string used to symmetrically encrypt and decrypt data stored in Redis.
91
+ // The key must be exactly 32 characters, longer values will be truncated. Default: "" (No encryption)
78
92
EncryptionKey string `json:"encryption_key"`
93
+ // Compression Specifies whether values should be compressed before storing in Redis. Default: false
79
94
Compression bool `json:"compression"`
80
95
// TlsEnabled controls whether TLS will be used to connect to the Redis
81
96
// server. False by default.
@@ -98,7 +113,9 @@ type RedisStorage struct {
98
113
// `x509.CertPool.AppendCertsFromPem` for details.
99
114
// https://pkg.go.dev/crypto/x509#CertPool.AppendCertsFromPEM
100
115
TlsServerCertsPath string `json:"tls_server_certs_path"`
116
+ // RouteByLatency Route commands by latency, only used in Cluster mode. Default: false
101
117
RouteByLatency bool `json:"route_by_latency"`
118
+ // RouteRandomly Route commands randomly, only used in Cluster mode. Default: false
102
119
RouteRandomly bool `json:"route_randomly"`
103
120
104
121
client redis.UniversalClient
0 commit comments