rdb

package
v0.93.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package rdb provides a singleton Redis client with connection pool configuration.

Index

Constants

This section is empty.

Variables

View Source
var Client *redis.Client

Client is the singleton Redis client, provided by NewClient via fx.

Functions

func BloomUnique

func BloomUnique(ctx context.Context, id string, latest []any) ([]any, error)

BloomUnique filters a slice of items through a Redis bloom filter, returning only the items that are newly added (i.e. unique). The bloom filter is identified by id and expires after bloomKeyTTL.

func BloomUniqueString

func BloomUniqueString(ctx context.Context, id, latest string) (bool, error)

BloomUniqueString checks whether a single string is unique using a Redis bloom filter identified by id. Returns true if the string was newly added (unique), false if it was already seen. The bloom filter expires after bloomKeyTTL.

func NewClient

func NewClient(lc fx.Lifecycle, _ *config.Type) (*redis.Client, error)

NewClient creates and returns a single Redis client configured from config.App.Redis. Connection pool parameters use go-redis defaults when set to zero, except ReadTimeout and WriteTimeout which fall back to 60s for backward compatibility.

func Shutdown

func Shutdown(ctx context.Context)

Shutdown gracefully closes the Redis client with a 5-second timeout. Client.Close is always called to release the connection pool, even when the ping fails (e.g. Redis is unreachable during shutdown).

Types

This section is empty.

Jump to

Keyboard shortcuts

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