redis

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisStore

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

func (*RedisStore) Append

func (r *RedisStore) Append(ctx context.Context, key string, value interface{}) error

func (*RedisStore) Del

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

func (*RedisStore) Get

func (r *RedisStore) Get(ctx context.Context, key string) (string, error)

func (*RedisStore) GetRedisPayload

func (r *RedisStore) GetRedisPayload(ctx context.Context, key string, payload interface{}) error

func (*RedisStore) Set

func (r *RedisStore) Set(ctx context.Context, key string, value interface{}, duration time.Duration) error

func (*RedisStore) SetOne

func (r *RedisStore) SetOne(ctx context.Context, key string, value interface{}, duration time.Duration) error

type Store

type Store interface {
	// in set we marshal the value to json
	Set(ctx context.Context, key string, value interface{}, duration time.Duration) error
	// in setOne we don't marshal the value to json
	SetOne(ctx context.Context, key string, value interface{}, duration time.Duration) error
	// need to unmarshal the value from json
	Get(ctx context.Context, key string) (string, error)
	// append to the key
	Append(ctx context.Context, key string, value interface{}) error

	// get the value and delete the key
	GetRedisPayload(ctx context.Context, key string, payload interface{}) error

	Del(ctx context.Context, key string) error
}

func NewRedis

func NewRedis(URL string) (Store, error)

Jump to

Keyboard shortcuts

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