Version: v0.0.0-...-0feb2aa Latest Latest

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 10 Imported by: 0




This section is empty.


This section is empty.


func New

func New(opts cache.Options) (cache.Cache, error)

New returns redis cache

func ParseSentinelURL

func ParseSentinelURL(redisURL string) (*redis.FailoverOptions, error)

ParseSentinelURL parses sentinel url to redis FailoverOptions. It's a modified version of go-redis ParseURL( because official version does not support parse sentinel mode.


type Cache

type Cache struct {
	// contains filtered or unexported fields

Cache redis cache

func (*Cache) Contains

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

Contains returns true if key exists

func (*Cache) Delete

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

Delete delete item from cache by key

func (*Cache) Fetch

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

Fetch retrieve the cached key value

func (*Cache) Keys

func (c *Cache) Keys(ctx context.Context, prefixes ...string) ([]string, error)

Keys returns the key matched by prefixes.

func (*Cache) Ping

func (c *Cache) Ping(ctx context.Context) error

Ping ping the cache

func (*Cache) Save

func (c *Cache) Save(ctx context.Context, key string, value interface{}, expiration ...time.Duration) error

Save cache the value by key

Source Files

Jump to

Keyboard shortcuts

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