redis

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package redis provides a wrapper around github.com/go-redis/redis, specifically to satisfy the cache.Cacher interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacher

type Cacher interface {
	Del(context.Context, ...string) error
	Get(context.Context, string) ([]byte, error)
	Set(context.Context, string, interface{}, time.Duration) error
}

func New

func New() Cacher

New returns an instance of Cacher.

type Client added in v0.20.2

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

Client holds a redisCacher instance, and satisfies the cache.Cache interface.

func (*Client) Del added in v0.20.2

func (c *Client) Del(ctx context.Context, keys ...string) error

Del deletes keys.

func (*Client) Get added in v0.20.2

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

Get returns the data stored under a key.

func (*Client) Set added in v0.20.2

func (c *Client) Set(ctx context.Context, key string, val interface{}, t time.Duration) error

Set stores data under a key for a set amount of time.

Jump to

Keyboard shortcuts

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