cache

package module
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 8 Imported by: 0

README

cache

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode added in v1.1.0

func Decode(data []byte, i interface{}) error

func Encode added in v1.1.0

func Encode(i interface{}) ([]byte, error)

Types

type Cache

type Cache interface {
	SaveObjs(exp time.Duration, docs ...CacheObj) error
	SaveObj(i CacheObj, exp time.Duration) error
	GetObj(key string, i CacheObj) error
	GetObjs(keys []string, d CacheObj) (objs []CacheObj, err error)
	SaveObjHash(i CacheMapObj, exp time.Duration) error
	GetObjHash(key string, i CacheMapObj) error
}

func NewRedisCache

func NewRedisCache(clt conn.RedisClient) Cache

type CacheMapObj

type CacheMapObj interface {
	GetKey() string
	EncodeMap() (map[string]string, error)
	DecodeMap(map[string]string) error
	SetExpiredTime(d time.Duration)
	GetExpiredTime() time.Duration
}

type CacheObj

type CacheObj interface {
	GetKey() string
	Encode() ([]byte, error)
	SetStringCmd(sc *redis.StringCmd)
	Decode([]byte) error
	DecodePipe() error
	GetError() error
	HasError() bool
	SetExpiredTime(d time.Duration)
	GetExpiredTime() time.Duration
}

type ComCacheObj

type ComCacheObj struct {
	E time.Duration
	// contains filtered or unexported fields
}

func (*ComCacheObj) DecodePipe

func (t *ComCacheObj) DecodePipe(obj CacheObj) error

func (*ComCacheObj) GetError

func (s *ComCacheObj) GetError() error

func (*ComCacheObj) GetExpiredTime added in v1.3.0

func (s *ComCacheObj) GetExpiredTime() time.Duration

func (*ComCacheObj) GetStringCmd

func (s *ComCacheObj) GetStringCmd() (*redis.StringCmd, error)

func (*ComCacheObj) HasError

func (s *ComCacheObj) HasError() bool

func (*ComCacheObj) SetExpiredTime added in v1.3.0

func (s *ComCacheObj) SetExpiredTime(d time.Duration)

func (*ComCacheObj) SetStringCmd

func (s *ComCacheObj) SetStringCmd(sc *redis.StringCmd)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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