cache

package
v0.0.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOption

func NewOption() *option

Types

type Cache

type Cache interface {
	// i()
	Set(key string, value interface{}, ttl time.Duration, options ...Option) error
	SetT(key string, value interface{}, ttl time.Duration, trace trace.T) error

	Get(key string, options ...Option) (string, error)
	GetT(key string, trace trace.T) (string, error)

	TTL(key string) (time.Duration, error)
	Expire(key string, ttl time.Duration) (bool, error)
	ExpireAt(key string, ttl time.Time) (bool, error)

	Exists(keys ...string) (bool, error)

	CheckGet(key string, options ...Option) (string, error)
	CheckGetT(key string, trace trace.T) (string, error)

	Del(key string, options ...Option) (int64, error)
	DelT(key string, trace trace.T) (int64, 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)

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

	Keys(pattern string) (r []string, err error)
	// HMSET KEY_NAME FIELD1 VALUE1 ...FIELD-N VALUE-N
	HMSet(key string, values ...interface{}) (bool, error)
	HMGet(key string, field ...string) ([]interface{}, error)
	Publish(channel string, message interface{}) (int64, error)

	Close() error
}

type Option

type Option func(*option)

func WithTrace

func WithTrace(t trace.T) Option

WithTrace 设置trace信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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