redis

package
v0.0.0-...-2a3cdc3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2020 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

type Redis struct {
	Config *redis.Options
	Client *redis.Client
}

Redis provides a cache backed by a Redis server.

func New

func New(config *redis.Options) *Redis

New returns an initialized Redis cache object.

func (*Redis) Delete

func (r *Redis) Delete(key string) error

Delete removes a specific key and its value from the Redis server.

func (*Redis) Fetch

func (r *Redis) Fetch(key string, fc func() interface{}) (string, error)

Fetch returns the value for the key if it exists or sets and returns the value via the passed function.

func (*Redis) Get

func (r *Redis) Get(key string) (string, error)

Get returns the value saved under a given key.

func (*Redis) Set

func (r *Redis) Set(key string, value interface{}) error

Set saves an arbitrary value under a specific key.

func (*Redis) Unmarshal

func (r *Redis) Unmarshal(key string, object interface{}) error

Unmarshal retrieves a value from the Redis server and unmarshals it into the passed object.

Jump to

Keyboard shortcuts

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