redis

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package redis provides Redis cache that implements cache.Cacher interface.

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
}

Cache is an implementation of cache.Cacher by Redis.

func NewCache

func NewCache(expiration time.Duration, client *redis.Client) *Cache

NewCache returns a new Cache with given expiration. If set to 0, each item has no expiration time.

func (*Cache) DeleteMulti

func (c *Cache) DeleteMulti(ctx context.Context, keys []*datastorepb.Key) error

DeleteMulti deletes items for the given keys.

func (*Cache) GetMulti

func (c *Cache) GetMulti(ctx context.Context, keys []*datastorepb.Key) [][]byte

GetMulti returns the values of the given keys as a slice of []byte. If the item is not found, the corresponding index of the return value will be nil.

func (*Cache) SetMulti

func (c *Cache) SetMulti(ctx context.Context, keys []*datastorepb.Key, values [][]byte)

SetMulti sets the given keys and values to items.

Source Files

Jump to

Keyboard shortcuts

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