cache

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caches

type Caches interface {
	Get(key string) (string, error)
	Del(key string) (int64, error)
	HSet(key, field, value string) (string, error)
	Set(key, value string, expire int) (string, error)
	AddInSet(key, value string) (int, error)
	GetSetMembers(key string) ([]string, error)
	GetSetLength(key string) (int, error)
	GetNElementOfSet(key string, n int) ([]string, error)
	PushNElementToSet(values []interface{}) (int, error)
}

type Handler

type Handler interface {
	Get() redigo.Conn
	GetContext(context.Context) (redigo.Conn, error)
}

Handler handler for cache

type RedisCfg

type RedisCfg struct {
	Address   string `yaml:"address"`
	Timeout   int    `yaml:"timeout"`
	MaxIdle   int    `yaml:"max_iddle"`
	MaxActive int    `yaml:"max_active"`
}

type Store

type Store struct {
	Pool Handler
}

Store object

func New

func New(cfg *RedisCfg) *Store

func (*Store) AddInSet

func (r *Store) AddInSet(key, value string) (int, error)

AddInSet will be used to add value in set

func (*Store) Del

func (r *Store) Del(key string) (int64, error)

Del key value

func (*Store) Get

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

Get string value

func (*Store) GetNElementOfSet

func (r *Store) GetNElementOfSet(key string, n int) ([]string, error)

GetNElementOfSet to get the first N elements of set

func (*Store) GetSetLength

func (r *Store) GetSetLength(key string) (int, error)

GetSetLength will be used to get the set length

func (*Store) GetSetMembers

func (r *Store) GetSetMembers(key string) ([]string, error)

GetSetMembers will be used to get the set memebers

func (*Store) HSet

func (r *Store) HSet(key, field, value string) (string, error)

HSet set has map

func (*Store) PushNElementToSet

func (r *Store) PushNElementToSet(values []interface{}) (int, error)

PushNElementToSet will be used to push n elements to set

func (*Store) Set

func (r *Store) Set(key, value string, expire int) (string, error)

Set ill be used to set the value

Jump to

Keyboard shortcuts

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