redisloader

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New[K comparable, V any](client ClientInterface, loader dataloader.Loader[K, V], options ...func(*option)) *redisDataLoader[K, V]

New creates a new RedisDataLoader

func WithExpiration

func WithExpiration(expiration time.Duration) func(*option)

WithExpiration sets the expiration time for the cache

func WithKeyFunc

func WithKeyFunc(keyFunc func(any) string) func(*option)

WithKeyFunc sets the key function for the cache

func WithMarshalFunc

func WithMarshalFunc(marshalFunc func(any) ([]byte, error)) func(*option)

WithMarshalFunc sets the marshal function for the cache

func WithUnmarshalFunc

func WithUnmarshalFunc(unmarshalFunc func([]byte, any) error) func(*option)

WithUnmarshalFunc sets the unmarshal function for the cache

Types

type ClientInterface

type ClientInterface interface {
	MGet(ctx context.Context, keys ...string) *redis.SliceCmd
	Pipelined(ctx context.Context, fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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