redis

package
v0.0.0-...-58998d9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

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 alternate implementation of a redis cache with built in pooling

func NewCache

func NewCache(client *Client, opts ...CacheOption) *Cache

NewCache returns a CacheV2 struct

func (*Cache) Check

func (c *Cache) Check(_ context.Context) error

Check is an implementation for our healthcheck endpoint to see if redis is responding to the ping

func (*Cache) Delete

func (c *Cache) Delete(k string) bool

Delete deletes a value for a key along with the namespace from the cache

func (*Cache) Get

func (c *Cache) Get(k string, val interface{}) bool

Get gets a value for a key along with the namespace from inside the cache

func (*Cache) Set

func (c *Cache) Set(k string, val interface{}, exp time.Duration) bool

Set sets a value for a key along with the namespace to the cache

func (*Cache) WithNamespace

func (c *Cache) WithNamespace(ns string) *Cache

WithNamespace returns a new cache struct with a different namepace using the same underlying connection

type CacheOption

type CacheOption func(*CacheOptions)

func Namespace

func Namespace(ns string) CacheOption

type CacheOptions

type CacheOptions struct {
	Logger    Logger
	Namespace string
}

func NewCacheOptions

func NewCacheOptions(opts ...CacheOption) CacheOptions

type Client

type Client struct {
	redis.UniversalClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...Option) *Client

type Logger

type Logger interface {
	Log(keyvals ...interface{}) error
}

type Option

type Option func(*Options)

func Addresses

func Addresses(addrs ...string) Option

func OptionLogger

func OptionLogger(l Logger) Option

func Password

func Password(pass string) Option

type Options

type Options struct {
	Addresses []string
	Password  string
	Logger    Logger
}

Options defines the set of parameters that can be passed as optional

func NewOptions

func NewOptions(opts ...Option) Options

NewOptions returns an Options struct with default options set

Jump to

Keyboard shortcuts

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