cachefetcher

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheFetcher

type CacheFetcher interface {
	SetKey(prefixes []string, useHash bool, elements ...string)
	Fetch(expiration time.Duration, dst interface{}, fetcher interface{}) (interface{}, error)
	SetVal(value interface{}, expiration time.Duration) error
	GetString() (string, error)
	GetVal(dst interface{}) (interface{}, error)
	DelVal() error
	Key() string
	IsCached() bool
}

func NewCacheFetcher

func NewCacheFetcher(client Client, options *Options) CacheFetcher

type Client

type Client interface {
	Set(key string, value interface{}, expiration time.Duration) error
	GetString(key string) (string, error)
	Get(key string, dst interface{}) error
	Del(key string) error
	IsFoundKey(err error) bool
}

type Options

type Options struct {
	Group          *singleflight.Group
	GroupTimeout   time.Duration
	WithStackTrace bool
	DebugPrintMode bool
}

type SampleCacheClientImpl

type SampleCacheClientImpl struct {
	Client redis.UniversalClient
	Ctx    context.Context
}

func (*SampleCacheClientImpl) Del

func (i *SampleCacheClientImpl) Del(key string) error

func (*SampleCacheClientImpl) Get

func (i *SampleCacheClientImpl) Get(key string, dst interface{}) error

func (*SampleCacheClientImpl) GetString

func (i *SampleCacheClientImpl) GetString(key string) (string, error)

func (*SampleCacheClientImpl) IsFoundKey

func (i *SampleCacheClientImpl) IsFoundKey(err error) bool

return a decision when key exists.

func (*SampleCacheClientImpl) Set

func (i *SampleCacheClientImpl) Set(key string, value interface{}, expiration time.Duration) error

Jump to

Keyboard shortcuts

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