redis

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"vef:redis",
	fx.Provide(
		fx.Annotate(
			NewClient,
			fx.OnStart(func(ctx context.Context, client *redis.Client) error {
				if err := client.Ping(ctx).Err(); err != nil {
					return fmt.Errorf("failed to connect to redis: %w", err)
				}

				return logRedisServerInfo(ctx, client)
			}),
			fx.OnStop(func(client *redis.Client) error {
				logger.Info("Closing Redis client...")

				return client.Close()
			}),
		),
	),
)

Module provides Redis client functionality with automatic lifecycle management.

Functions

func HealthCheck

func HealthCheck(ctx context.Context, client *redis.Client) error

HealthCheck verifies Redis availability for monitoring endpoints.

func NewClient

func NewClient(cfg *config.RedisConfig, appCfg *config.AppConfig) *redis.Client

NewClient creates a Redis client with adaptive pool sizing to balance performance and resource usage.

Types

This section is empty.

Jump to

Keyboard shortcuts

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