kvs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValueStore

type KeyValueStore struct {
	// contains filtered or unexported fields
}

func New

func New(c Store) KeyValueStore

func (KeyValueStore) Del

func (kvs KeyValueStore) Del(ctx context.Context, key ...string) error

func (KeyValueStore) Get

func (kvs KeyValueStore) Get(ctx context.Context, key string, result any) error

func (KeyValueStore) GetSet

func (kvs KeyValueStore) GetSet(ctx context.Context, key string, value any, ttl time.Duration, oldValue any) error

func (KeyValueStore) Set

func (kvs KeyValueStore) Set(ctx context.Context, key string, value any, ttl time.Duration) error

type RedisStore

type RedisStore struct {
	// contains filtered or unexported fields
}

func NewRedis

func NewRedis(redis *redis.Client) RedisStore

func (RedisStore) Del

func (r RedisStore) Del(ctx context.Context, keys ...string) error

func (RedisStore) Get

func (r RedisStore) Get(ctx context.Context, key string) ([]byte, error)

func (RedisStore) GetSet

func (r RedisStore) GetSet(ctx context.Context, key string, value []byte, ttl time.Duration) ([]byte, error)

func (RedisStore) Set

func (r RedisStore) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error

type Store

type Store interface {
	Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
	Get(ctx context.Context, key string) ([]byte, error)
	GetSet(ctx context.Context, key string, value []byte, ttl time.Duration) ([]byte, error)
	Del(ctx context.Context, key ...string) error
}

Jump to

Keyboard shortcuts

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