cache

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(addr, password, prefix string, db int) (*Cache, error)

func (*Cache) Delete

func (c *Cache) Delete(ctx context.Context, key string) (int64, error)

func (*Cache) Exists

func (c *Cache) Exists(ctx context.Context, key string) (bool, error)

func (*Cache) Expire

func (c *Cache) Expire(ctx context.Context, key string, seconds int64) (bool, error)

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string) (string, error)

Get Redis `GET key` command. It returns redis.Nil error when key does not exist.

func (*Cache) GetListIndex

func (c *Cache) GetListIndex(ctx context.Context, key string, value string) (int, error)

func (*Cache) Inc

func (c *Cache) Inc(ctx context.Context, key string) (int64, error)

func (*Cache) IncrBy

func (c *Cache) IncrBy(ctx context.Context, key string, value int64) (int64, error)

func (*Cache) LPop

func (c *Cache) LPop(ctx context.Context, key string) (string, error)

func (*Cache) LPush

func (c *Cache) LPush(ctx context.Context, key string, value ...interface{}) (int64, error)

func (*Cache) RPop

func (c *Cache) RPop(ctx context.Context, key string) (string, error)

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, key string, value []byte, seconds int64) error

Set Redis `SET key value [expiration]` command.

func (*Cache) TTL

func (c *Cache) TTL(ctx context.Context, key string) (time.Duration, error)

func (*Cache) ZAdd

func (c *Cache) ZAdd(ctx context.Context, key string, members ...*Z) (int64, error)

func (*Cache) ZCard

func (c *Cache) ZCard(ctx context.Context, key string) (int64, error)

func (*Cache) ZRange

func (c *Cache) ZRange(ctx context.Context, key string, start, end int64) ([]string, error)

func (*Cache) ZRank

func (c *Cache) ZRank(ctx context.Context, key, member string) (int64, error)

func (*Cache) ZRem

func (c *Cache) ZRem(ctx context.Context, key string, members []interface{}) (int64, error)

func (*Cache) ZScan

func (c *Cache) ZScan(ctx context.Context, key string, cursor uint64, match string, count int64) ([]string, uint64, error)

type Z

type Z struct {
	Score  float64
	Member interface{}
}

Jump to

Keyboard shortcuts

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