cache

package
v0.0.0-...-ca93976 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(key string, value string, expiration time.Duration) (err error)
	Get(key string) (value string, err error)
	HSet(key string, values ...interface{}) (err error)
	HGet(key string, field string) (value string, err error)
	HGetAll(key string) (values map[string]string, err error)
}

type Memory

type Memory struct {
	Cache map[string]any
}

func NewMemory

func NewMemory() (*Memory, error)

func (*Memory) Get

func (m *Memory) Get(key string) (string, error)

func (*Memory) HGet

func (m *Memory) HGet(key string, field string) (string, error)

func (*Memory) HGetAll

func (m *Memory) HGetAll(key string) (map[string]string, error)

func (*Memory) HSet

func (m *Memory) HSet(key string, values ...interface{}) error

func (*Memory) Set

func (m *Memory) Set(key, value string, expiration time.Duration) error

type Redis

type Redis struct {
	*redis.Client
	context.Context
}

func NewRedis

func NewRedis(url string) (*Redis, error)

func (*Redis) Get

func (r *Redis) Get(key string) (string, error)

func (*Redis) HGet

func (r *Redis) HGet(key string, field string) (string, error)

func (*Redis) HGetAll

func (r *Redis) HGetAll(key string) (map[string]string, error)

func (*Redis) HSet

func (r *Redis) HSet(key string, values ...interface{}) error

func (*Redis) Set

func (r *Redis) Set(key, value string, expiration time.Duration) error

Jump to

Keyboard shortcuts

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