Documentation ¶
Index ¶
- type RedisStorage
- func (rs *RedisStorage) Cleanup() error
- func (rs RedisStorage) Delete(ctx context.Context, key string) error
- func (rs RedisStorage) Exists(ctx context.Context, key string) bool
- func (rs *RedisStorage) GetClient() any
- func (rs RedisStorage) List(ctx context.Context, dir string, recursive bool) ([]string, error)
- func (rs RedisStorage) Load(ctx context.Context, key string) ([]byte, error)
- func (rs *RedisStorage) Lock(ctx context.Context, name string) error
- func (rs *RedisStorage) ProvisionCertMagic(ctx context.Context, log *zap.Logger) error
- func (rs *RedisStorage) Repair(ctx context.Context, dir string) error
- func (rs RedisStorage) Stat(ctx context.Context, key string) (certmagic.KeyInfo, error)
- func (rs RedisStorage) Store(ctx context.Context, key string, value []byte) error
- func (rs RedisStorage) String() string
- func (rs *RedisStorage) Unlock(ctx context.Context, name string) error
- type StorageData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisStorage ¶
type RedisStorage struct { // ClientType specifies the Redis client type. Valid values are "cluster" or "failover" ClientType string `json:"client_type"` // Address The full address of the Redis server. Example: "127.0.0.1:6379" // If not defined, will be generated from Host and Port parameters. Address []string `json:"address"` // Host The Redis server hostname or IP address. Default: "127.0.0.1" Host []string `json:"host"` // Host The Redis server port number. Default: "6379" Port []string `json:"port"` // DB The Redis server database number. Default: 0 DB int `json:"db"` // Timeout The Redis server timeout in seconds. Default: 5 Timeout string `json:"timeout"` // Username The username for authenticating with the Redis server. Default: "" (No authentication) Username string `json:"username"` // Password The password for authenticating with the Redis server. Default: "" (No authentication) Password string `json:"password"` // MasterName Only required when connecting to Redis via Sentinal (Failover mode). Default "" MasterName string `json:"master_name"` // KeyPrefix A string prefix that is appended to Redis keys. Default: "caddy" // Useful when the Redis server is used by multiple applications. KeyPrefix string `json:"key_prefix"` // EncryptionKey A key string used to symmetrically encrypt and decrypt data stored in Redis. // The key must be exactly 32 characters, longer values will be truncated. Default: "" (No encryption) EncryptionKey string `json:"encryption_key"` // Compression Specifies whether values should be compressed before storing in Redis. Default: false Compression bool `json:"compression"` // TlsEnabled controls whether TLS will be used to connect to the Redis // server. False by default. TlsEnabled bool `json:"tls_enabled"` // TlsInsecure controls whether the client will verify the server // certificate. See `InsecureSkipVerify` in `tls.Config` for details. True // by default. // https://pkg.go.dev/crypto/tls#Config TlsInsecure bool `json:"tls_insecure"` // TlsServerCertsPEM is a series of PEM encoded certificates that will be // used by the client to validate trust in the Redis server's certificate // instead of the system trust store. May not be specified alongside // `TlsServerCertsPath`. See `x509.CertPool.AppendCertsFromPem` for details. // https://pkg.go.dev/crypto/x509#CertPool.AppendCertsFromPEM TlsServerCertsPEM string `json:"tls_server_certs_pem"` // TlsServerCertsPath is the path to a file containing a series of PEM // encoded certificates that will be used by the client to validate trust in // the Redis server's certificate instead of the system trust store. May not // be specified alongside `TlsServerCertsPem`. See // `x509.CertPool.AppendCertsFromPem` for details. // https://pkg.go.dev/crypto/x509#CertPool.AppendCertsFromPEM TlsServerCertsPath string `json:"tls_server_certs_path"` // RouteByLatency Route commands by latency, only used in Cluster mode. Default: false RouteByLatency bool `json:"route_by_latency"` // RouteRandomly Route commands randomly, only used in Cluster mode. Default: false RouteRandomly bool `json:"route_randomly"` // contains filtered or unexported fields }
RedisStorage implements a Caddy storage backend for Redis It supports Single (Standalone), Cluster, or Sentinal (Failover) Redis server configurations.
func (*RedisStorage) Cleanup ¶
func (rs *RedisStorage) Cleanup() error
func (*RedisStorage) GetClient ¶
func (rs *RedisStorage) GetClient() any
GetClient returns the Redis client initialized by this storage.
This is useful for other modules that need to interact with the same Redis instance. The return type of GetClient is "any" for forward-compatibility new versions of go-redis. The returned value must usually be cast to redis.UniversalClient.
func (*RedisStorage) ProvisionCertMagic ¶
func (RedisStorage) String ¶
func (rs RedisStorage) String() string
Click to show internal directories.
Click to hide internal directories.