kvs

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 7 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 New

func New(addr string) (*Cache, error)

func (*Cache) Client

func (c *Cache) Client() *redis.Client

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) Delete

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

Delete key

func (*Cache) Get

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

Get string value

func (*Cache) GetBytes

func (c *Cache) GetBytes(ctx context.Context, key string) ([]byte, error)

func (*Cache) GetInt64

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

GetInt64 return int64 value of key

func (*Cache) GetJSON

func (c *Cache) GetJSON(ctx context.Context, key string, v interface{}) error

GetJSON unmarshal json into v

func (*Cache) HDel added in v1.5.0

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

func (*Cache) HGet added in v1.5.0

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

func (*Cache) HGetAll added in v1.5.0

func (c *Cache) HGetAll(ctx context.Context, key string) (map[string]string, error)

func (*Cache) HSet added in v1.5.0

func (c *Cache) HSet(ctx context.Context, key, field, value string) error

func (*Cache) Incr

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

Incr increment numerical value

func (*Cache) Set

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

Set string value

func (*Cache) SetInt64

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

SetInt64 set int64 value

func (*Cache) SetJSON

func (c *Cache) SetJSON(ctx context.Context, key string, val interface{}) error

SetJSON marshal set marshaled json of val

func (*Cache) SetTTL

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

SetTTL set expiration time for key

func (*Cache) SetTimed

func (c *Cache) SetTimed(ctx context.Context, key, val string, ttl int64) error

SetTimed set string value with expiration time in seconds

func (*Cache) SetTimedInt64

func (c *Cache) SetTimedInt64(ctx context.Context, key string, val int64, ttl int64) error

SetTimedInt64 set int64 value with expiration time in seconds

func (*Cache) SetTimedJSON

func (c *Cache) SetTimedJSON(ctx context.Context, key string, val interface{}, ttl int64) error

func (*Cache) SetTimedJSONNX added in v1.7.0

func (c *Cache) SetTimedJSONNX(ctx context.Context, key string, val interface{}, ttl int64) (bool, error)

func (*Cache) XAdd added in v1.5.0

func (c *Cache) XAdd(ctx context.Context, stream string, maxLen int64, approx bool, values map[string]interface{}) error

Jump to

Keyboard shortcuts

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