extredis

package
v0.0.0-...-a4179b6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTTL = time.Minute
)

Variables

View Source
var (
	ErrCacheMiss = errors.New("big_cache: key/value is not cached")
)

Functions

func CloseConnPool

func CloseConnPool()

func InitConnPool

func InitConnPool(cfg *config.Cache)

func Marshal

func Marshal(value interface{}) ([]byte, error)

func NewConnPoolContext

func NewConnPoolContext(ctx context.Context) (context.Context, context.CancelFunc)

func Unmarshal

func Unmarshal(b []byte, value interface{}) error

Types

type BigCache

type BigCache struct {
	// contains filtered or unexported fields
}

func InstallBigCache

func InstallBigCache(pool *RedisClientConnPool) *BigCache

func (*BigCache) Decr

func (impl *BigCache) Decr(
	ctx context.Context,
	key string,
) error

func (*BigCache) Del

func (impl *BigCache) Del(
	ctx context.Context,
	key string,
) error

func (*BigCache) Exist

func (impl *BigCache) Exist(
	ctx context.Context,
	key string,
) bool

func (*BigCache) Get

func (impl *BigCache) Get(
	ctx context.Context,
	key string,
	value interface{},
) error

func (*BigCache) GetInt

func (impl *BigCache) GetInt(
	ctx context.Context,
	key string,
	value *int,
) error

func (*BigCache) GetInt64

func (impl *BigCache) GetInt64(
	ctx context.Context,
	key string,
	value *int64,
) error

func (*BigCache) GetString

func (impl *BigCache) GetString(
	ctx context.Context,
	key string,
	value *string,
) error

func (*BigCache) Incr

func (impl *BigCache) Incr(
	ctx context.Context,
	key string,
) error

func (*BigCache) Keys

func (impl *BigCache) Keys(
	ctx context.Context,
	cursor uint64,
	pattern string,
	batchSize int64,
) ([]string, uint64, bool, error)

func (*BigCache) SafeDecr

func (impl *BigCache) SafeDecr(
	ctx context.Context,
	key string,
) error

SafeDecr is like Decr but makes sure the value never goes below zero.

func (*BigCache) Set

func (impl *BigCache) Set(
	ctx context.Context,
	item *Item,
) error

func (*BigCache) SetInt

func (impl *BigCache) SetInt(
	ctx context.Context,
	item *Item,
) error

func (*BigCache) SetInt64

func (impl *BigCache) SetInt64(
	ctx context.Context,
	item *Item,
) error

func (*BigCache) SetString

func (impl *BigCache) SetString(
	ctx context.Context,
	item *Item,
) error

type Item

type Item struct {
	// contains filtered or unexported fields
}

func (*Item) Key

func (item *Item) Key() string

func (*Item) SetKey

func (item *Item) SetKey(key string)

func (*Item) SetTTL

func (item *Item) SetTTL(ttl time.Duration)

func (*Item) SetValue

func (item *Item) SetValue(value interface{})

func (*Item) TTL

func (item *Item) TTL() time.Duration

func (*Item) Value

func (item *Item) Value() interface{}

type RedisClientConnPool

type RedisClientConnPool struct {
	// contains filtered or unexported fields
}

func GetConnPool

func GetConnPool() *RedisClientConnPool

func (*RedisClientConnPool) GetBigCache

func (p *RedisClientConnPool) GetBigCache() *BigCache

Jump to

Keyboard shortcuts

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