cache

package
v0.0.0-...-5a547ea Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 3 Imported by: 1

README

cache

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFreeCache

func NewFreeCache(size, expireSeconds int) *freecache.Cache

func NewGoCache

func NewGoCache(expireSeconds, cleanupSeconds int) *gocache.Cache

Types

type Cache

type Cache interface {
	Delete(key string) bool
	SetBytes(key string, value []byte, expireSeconds ...int) error
	GetBytes(key string) ([]byte, error)
	SetString(key string, value string, expireSeconds ...int) error
	GetString(key string) (string, error)
	SetInterface(key string, value interface{}, expireSeconds ...int) error
	GetInterface(key string, values ...interface{}) (interface{}, error)
}

func NewCache

func NewCache(c *Config) Cache

type Config

type Config struct {
	MoreString      bool
	MoreInterface   bool
	Size            int
	ExpireSeconds   int
	CleanupInterval int
}
var DefaultConfig *Config = &Config{
	MoreString:      true,
	MoreInterface:   false,
	Size:            1024,
	ExpireSeconds:   60,
	CleanupInterval: 30,
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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