cache

package
v0.0.0-...-68c1abf Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 7 Imported by: 0

README

cache

-- import "."

Usage

type Cache
type Cache struct {
}

Cache is a logged and instrumented wrapper around a redis client.

func New
func New(client Client) *Cache

New creates a new Cache.

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

GetValue retrieves the value from redis.

type Client
type Client interface {
	AddHook(redis.Hook)
	WithContext(context.Context) *redis.Client
}

Client represents the functions needed for this wrapper.

type LoggerHook
type LoggerHook struct {
}

LoggerHook is used to log all calls to redis.

func (LoggerHook) AfterProcess
func (h LoggerHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

AfterProcess is called after the call to redis for a single command.

func (LoggerHook) AfterProcessPipeline
func (h LoggerHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

AfterProcessPipeline is called after the call to redis for a group of pipelined commands.

func (LoggerHook) BeforeProcess
func (h LoggerHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

BeforeProcess is called before the call to redis for a single command.

func (LoggerHook) BeforeProcessPipeline
func (h LoggerHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

BeforeProcessPipeline is called before the call to redis for a group of pipelined commands.

type NewRelicHook
type NewRelicHook struct {
}

NewRelicHook is used to instrument all calls to redis using a newrelic segment.

func (NewRelicHook) AfterProcess
func (h NewRelicHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

AfterProcess is called after the call to redis for a single command.

func (NewRelicHook) AfterProcessPipeline
func (h NewRelicHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

AfterProcessPipeline is called after the call to redis for a group of pipelined commands.

func (NewRelicHook) BeforeProcess
func (h NewRelicHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

BeforeProcess is called before the call to redis for a single command.

func (NewRelicHook) BeforeProcessPipeline
func (h NewRelicHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

BeforeProcessPipeline is called before the call to redis for a group of pipelined commands.

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 a logged and instrumented wrapper around a redis client.

func New

func New(client Client) *Cache

New creates a new Cache.

func (*Cache) GetValue

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

GetValue retrieves the value from redis.

type Client

type Client interface {
	AddHook(redis.Hook)
	WithContext(context.Context) *redis.Client
}

Client represents the functions needed for this wrapper.

type LoggerHook

type LoggerHook struct {
}

LoggerHook is used to log all calls to redis.

func (LoggerHook) AfterProcess

func (h LoggerHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

AfterProcess is called after the call to redis for a single command.

func (LoggerHook) AfterProcessPipeline

func (h LoggerHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

AfterProcessPipeline is called after the call to redis for a group of pipelined commands.

func (LoggerHook) BeforeProcess

func (h LoggerHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

BeforeProcess is called before the call to redis for a single command.

func (LoggerHook) BeforeProcessPipeline

func (h LoggerHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

BeforeProcessPipeline is called before the call to redis for a group of pipelined commands.

type NewRelicHook

type NewRelicHook struct {
}

NewRelicHook is used to instrument all calls to redis using a newrelic segment.

func (NewRelicHook) AfterProcess

func (h NewRelicHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error

AfterProcess is called after the call to redis for a single command.

func (NewRelicHook) AfterProcessPipeline

func (h NewRelicHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

AfterProcessPipeline is called after the call to redis for a group of pipelined commands.

func (NewRelicHook) BeforeProcess

func (h NewRelicHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

BeforeProcess is called before the call to redis for a single command.

func (NewRelicHook) BeforeProcessPipeline

func (h NewRelicHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

BeforeProcessPipeline is called before the call to redis for a group of pipelined commands.

Jump to

Keyboard shortcuts

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