cache

package
v0.0.0-...-b34ddb9 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Request and connect timeout
	DefaultTimeout = time.Second * 30
)

Variables

View Source
var (
	ErrTooBusy = errors.New("conn pool too busy")
)

Functions

This section is empty.

Types

type CacheManager

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

func NewCacheManager

func NewCacheManager(server string, maxOpen int) *CacheManager

func (*CacheManager) Get

func (m *CacheManager) Get(key Key, tp NewableFromBytes, expire time.Duration, generate GenerateFunc) (Cacheable, error)

type Cacheable

type Cacheable interface {
	NewableFromBytes
	EncodeToBytes() ([]byte, error)
}

type GenerateFunc

type GenerateFunc func(key Key) (Cacheable, error)

type Key

type Key interface {
	String() string
}

type NewableFromBytes

type NewableFromBytes interface {
	NewFromBytes(data []byte) (Cacheable, error)
}

Jump to

Keyboard shortcuts

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