cache

package
v0.0.0-...-a5a6d41 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheNoHn = errors.New("No cache handler initialized")

ErrCacheNoHn is the error encountered when there is no valid handler initialized and still calling the cache methods

View Source
var ErrCacheNoHost = errors.New("No valid host address(es) provided")

ErrCacheNoHost is the error encountered when the provided Redis/Hosts are not available

View Source
var ErrNotFound = errors.New("Key does not exist")

ErrNotFound is the error encountered when key not found in the cache

Functions

This section is empty.

Types

type Config

type Config struct {
	Hosts        []string
	Name         string
	Password     string
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

type Handler

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

func New

func New(c Config) (*Handler, error)

func (*Handler) Get

func (h *Handler) Get(key string, result interface{}) error

func (*Handler) Ping

func (h *Handler) Ping() error

func (*Handler) Set

func (h *Handler) Set(key string, value interface{}, expiry time.Duration) error

type Service

type Service interface {
	Set(key string, value interface{}, expiry time.Duration) error
	Get(key string, result interface{}) error
	// HSet(string, string, interface{}, time.Duration, bool) error
	// HGet(string, string, interface{}) (error)
	// Delete(...string) error
	// HDelete(string, ...string) error
	Ping() error
}

Service interface should have all the required methods This interface is implemented to remove isCluster check for every call

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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