redisloader

package
v0.0.0-...-2d674cb Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONMarshaller

type JSONMarshaller struct{}

func (JSONMarshaller) MarshalRedis

func (JSONMarshaller) MarshalRedis(a any) (string, error)

func (JSONMarshaller) UnmarshalRedis

func (JSONMarshaller) UnmarshalRedis(s string) (any, error)

type KeyAdapter

type KeyAdapter interface {
	AdaptKey(any) (string, error)
}

type Marshaller

type Marshaller interface {
	MarshalRedis(any) (string, error)
	UnmarshalRedis(string) (any, error)
}

type RedisLoader

type RedisLoader struct {
	redis.UniversalClient
	Marshaller
	loadingcache.Loader
	KeyAdapter
	Expiration time.Duration
}

func New

func New(client redis.UniversalClient, exp time.Duration) *RedisLoader

func (*RedisLoader) Load

func (r *RedisLoader) Load(key any, cache loadingcache.Cache) (any, error)

func (*RedisLoader) WithKeyAdapter

func (r *RedisLoader) WithKeyAdapter(keyAdapter KeyAdapter) *RedisLoader

func (*RedisLoader) WithLoader

func (r *RedisLoader) WithLoader(loader loadingcache.Loader) *RedisLoader

func (*RedisLoader) WithMarshaller

func (r *RedisLoader) WithMarshaller(marshaller Marshaller) *RedisLoader

Jump to

Keyboard shortcuts

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