trredis

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 8 Imported by: 0

README

GoDoc

trcache redis

Installation

go get github.com/RangelReale/trcache/cache/redis

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDefaultDuration

func WithDefaultDuration[K comparable, V any](duration time.Duration) trcache.RootOption

func WithDeleteCustomParams

func WithDeleteCustomParams[K comparable, V any](customParams interface{}) trcache.DeleteOption

func WithDeleteRedisDelFunc

func WithDeleteRedisDelFunc[K comparable, V any](redisDelFunc RedisDelFunc[K, V]) trcache.DeleteOption

func WithDeleteRedisDelFuncFunc

func WithDeleteRedisDelFuncFunc[K comparable, V any](redisDelFunc RedisDelFuncFunc[K, V]) trcache.DeleteOption

func WithGetCustomParams

func WithGetCustomParams[K comparable, V any](customParams interface{}) trcache.GetOption

func WithGetRedisGetFunc

func WithGetRedisGetFunc[K comparable, V any](redisGetFunc RedisGetFunc[K, V]) trcache.GetOption

func WithGetRedisGetFuncFunc

func WithGetRedisGetFuncFunc[K comparable, V any](redisGetFunc RedisGetFuncFunc[K, V]) trcache.GetOption

func WithKeyCodec

func WithKeyCodec[K comparable, V any](keyCodec trcache.KeyCodec[K]) trcache.RootOption

func WithRedisDelFunc

func WithRedisDelFunc[K comparable, V any](redisDelFunc RedisDelFunc[K, V]) trcache.RootOption

func WithRedisGetFunc

func WithRedisGetFunc[K comparable, V any](redisGetFunc RedisGetFunc[K, V]) trcache.RootOption

func WithRedisSetFunc

func WithRedisSetFunc[K comparable, V any](redisSetFunc RedisSetFunc[K, V]) trcache.RootOption

func WithSetCustomParams

func WithSetCustomParams[K comparable, V any](customParams interface{}) trcache.SetOption

func WithSetRedisSetFunc

func WithSetRedisSetFunc[K comparable, V any](redisSetFunc RedisSetFunc[K, V]) trcache.SetOption

func WithSetRedisSetFuncFunc

func WithSetRedisSetFuncFunc[K comparable, V any](redisSetFuncFunc RedisSetFuncFunc[K, V]) trcache.SetOption

func WithValidator

func WithValidator[K comparable, V any](validator trcache.Validator[V]) trcache.RootOption

func WithValueCodec

func WithValueCodec[K comparable, V any](valueCodec trcache.Codec[V]) trcache.RootOption

Types

type Cache

type Cache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](redis *redis.Client, options ...trcache.RootOption) (*Cache[K, V], error)

func (*Cache[K, V]) Delete

func (c *Cache[K, V]) Delete(ctx context.Context, key K, options ...trcache.DeleteOption) error

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(ctx context.Context, key K, options ...trcache.GetOption) (V, error)

func (*Cache[K, V]) Handle

func (c *Cache[K, V]) Handle() *redis.Client

func (*Cache[K, V]) Name

func (c *Cache[K, V]) Name() string

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(ctx context.Context, key K, value V, options ...trcache.SetOption) error

type DefaultRedisDelFunc

type DefaultRedisDelFunc[K comparable, V any] struct {
}

func (DefaultRedisDelFunc[K, V]) Delete

func (f DefaultRedisDelFunc[K, V]) Delete(ctx context.Context, c *Cache[K, V], keyValue string, _ any) error

type DefaultRedisGetFunc

type DefaultRedisGetFunc[K comparable, V any] struct {
}

func (DefaultRedisGetFunc[K, V]) Get

func (f DefaultRedisGetFunc[K, V]) Get(ctx context.Context, c *Cache[K, V], keyValue string, _ any) (string, error)

type DefaultRedisSetFunc

type DefaultRedisSetFunc[K comparable, V any] struct {
}

func (DefaultRedisSetFunc[K, V]) Set

func (f DefaultRedisSetFunc[K, V]) Set(ctx context.Context, c *Cache[K, V], keyValue string, value any,
	expiration time.Duration, _ any) error

type RedisDelFunc

type RedisDelFunc[K comparable, V any] interface {
	Delete(ctx context.Context, c *Cache[K, V], keyValue string, customParams any) error
}

type RedisDelFuncFunc

type RedisDelFuncFunc[K comparable, V any] func(ctx context.Context, c *Cache[K, V], keyValue string, customParams any) error

func (RedisDelFuncFunc[K, V]) Delete

func (o RedisDelFuncFunc[K, V]) Delete(ctx context.Context, c *Cache[K, V], keyValue string, customParams any) error

type RedisGetFunc

type RedisGetFunc[K comparable, V any] interface {
	Get(ctx context.Context, c *Cache[K, V], keyValue string, customParams any) (string, error)
}

type RedisGetFuncFunc

type RedisGetFuncFunc[K comparable, V any] func(ctx context.Context, c *Cache[K, V], keyValue string, customParams any) (string, error)

func (RedisGetFuncFunc[K, V]) Get

func (o RedisGetFuncFunc[K, V]) Get(ctx context.Context, c *Cache[K, V], keyValue string, customParams any) (string, error)

type RedisSetFunc

type RedisSetFunc[K comparable, V any] interface {
	Set(ctx context.Context, c *Cache[K, V], keyValue string, value any, expiration time.Duration, customParams any) error
}

type RedisSetFuncFunc

type RedisSetFuncFunc[K comparable, V any] func(ctx context.Context, c *Cache[K, V], keyValue string, value any, expiration time.Duration, customParams any) error

func (RedisSetFuncFunc[K, V]) Set

func (o RedisSetFuncFunc[K, V]) Set(ctx context.Context, c *Cache[K, V], keyValue string, value any, expiration time.Duration, customParams any) error

type RefreshCache added in v0.5.0

type RefreshCache[K comparable, V any, RD any] struct {
	*Cache[K, V]
	// contains filtered or unexported fields
}

func NewRefresh

func NewRefresh[K comparable, V any, RD any](redis *redis.Client,
	options ...trcache.RootOption) (*RefreshCache[K, V, RD], error)

func (*RefreshCache[K, V, RD]) GetOrRefresh added in v0.5.0

func (c *RefreshCache[K, V, RD]) GetOrRefresh(ctx context.Context, key K, options ...trcache.RefreshOption) (V, error)

Jump to

Keyboard shortcuts

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