redis

package module
v0.0.0-...-8e9e02e Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

This file contains code used to interact with Redis in Fabriktor. It follows the port and adapter approach.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	FS embed.FS
	// contains filtered or unexported fields
}

func NewAdapter

func NewAdapter(l util.LoggerPort, FS embed.FS, host string, cfg RedisClientConfig) *Adapter

func (*Adapter) Close

func (a *Adapter) Close(ctx context.Context) error

Close closes the Redis client.

func (*Adapter) GetClient

func (a *Adapter) GetClient() *redis.Client

GetClient returns the Redis client.

func (*Adapter) SetClient

func (a *Adapter) SetClient(ctx context.Context) error

SetClient sets the Redis client in the adapter.

type RedisClientConfig

type RedisClientConfig struct {
	Password string
	Socket   Socket
}

RedisClientConfig represents the configuration for the Redis client.

type Socket

type Socket struct {
	Cert      string
	Key       string
	CA        string
	Port      int
	UseTLS    bool
	MutualTLS bool
}

Socket represents the configuration for the Redis socket.

Fields: - Port: The port number for the Redis connection. This is required. - UseTLS: A boolean flag indicating whether TLS is required for the connection.

  • Set this to `true` to enable TLS. This will configure the client to use TLS when connecting to Redis.
  • If `false`, no TLS will be used.

- MutualTLS: A boolean flag indicating whether mutual TLS is required for the connection.

  • If `true`, both the client and server will authenticate each other using certificates.
  • If `false`, only server-side TLS will be used (client will verify the server certificate but won't send its own).

- Cert: Path to the client certificate file (only required when MutualTLS is `true`). - Key: Path to the client key file (only required when MutualTLS is `true`). - CA: Path to the certificate authority file (required if MutualTLS is `true`).

Example: - To connect using TLS but without mutual authentication, set `UseTLS` to `true` and `MutualTLS` to `false`. - To connect without any TLS, set `UseTLS` to `false`.

Jump to

Keyboard shortcuts

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