redis

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SCAN_COUNT = 10000

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisConfig

type RedisConfig struct {
	Addr         string `yaml:"addr"`
	Pass         string `yaml:"pass"`
	Db           int    `yaml:"db"`
	MaxRetries   int    `yaml:"maxRetries"`
	PoolSize     int    `yaml:"poolSize"`
	MinIdleConns int    `yaml:"minIdleConns"`
}

type Repo

type Repo interface {
	Set(key string, value interface{}, ttl time.Duration, options ...cache.Option) error
	Get(key string, options ...cache.Option) (string, error)
	TTL(key string) (time.Duration, error)
	Expire(key string, ttl time.Duration) (bool, error)
	ExpireAt(key string, ttl time.Time) (bool, error)
	Del(key string, options ...cache.Option) (int64, error)
	Exists(keys ...string) (bool, error)
	Incr(key string, options ...cache.Option) (int64, error)
	Close() error
	Version() string

	CheckGet(key string, options ...cache.Option) (string, error)

	GetScanKeys(pattern string) (result []string, err error)
	GetSScanKeys(key string, pattern string) (result []string, err error)
	GetHScanKeys(key string, pattern string) (result []string, err error)

	SetT(key string, value interface{}, ttl time.Duration, trace trace.T) error
	GetT(key string, trace trace.T) (string, error)
	DelT(key string, trace trace.T) (int64, error)
	CheckGetT(key string, trace trace.T) (string, error)

	HGet(key, field string, options ...cache.Option) (string, error)
	HSet(key string, values []any, options ...cache.Option) error
	HSetValues(key string, values ...interface{}) error
	HMSet(key string, values ...interface{}) (bool, error)
	HMGet(key string, field ...string) ([]interface{}, error)
	HDel(key string, field ...string) (int64, error)
	HGetAll(key string) (map[string]string, error)

	SMembers(key string) ([]string, error)
	SIsMember(key, member string) bool
	SAdd(key, member string) error
	SRem(key, member string) error

	RPop(key string) (r string, err error)
	BRPop(key string) (r []string, err error)
	LPush(key string, value interface{}) error

	Keys(pattern string) (r []string, err error)
	RunScript(script string, keys []string, args ...interface{}) error
	Subscribe(channels ...string) <-chan *redis.Message
	Publish(channel string, message interface{}) (int64, error)
	// contains filtered or unexported methods
}

func New

func New(cfg *RedisConfig) (Repo, error)

Jump to

Keyboard shortcuts

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