redis

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache(url *url.URL) (cache.Cache, error)

NewCache create new redis cache

Types

type Cache

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

Cache redis cache object

func NewRedisCache

func NewRedisCache(address string, ns string) (*Cache, error)

NewRedisCache creating instance of redis cache

func (*Cache) Close

func (c *Cache) Close() error

Close close connection

func (*Cache) Delete

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

Delete delete record

func (*Cache) Exist

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

Exist check if key exist

func (*Cache) Get

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

Get get value

func (*Cache) GetFloat

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

GetFloat get float value

func (*Cache) GetInt

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

GetInt get int value

func (*Cache) GetObject

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

GetObject get object value

func (*Cache) GetString

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

GetString get string value

func (*Cache) RemainingTime

func (c *Cache) RemainingTime(ctx context.Context, key string) int

RemainingTime get remaining time

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, key string, value interface{}, expiration int) error

Set set value

Jump to

Keyboard shortcuts

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