cache

package
v2.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cache provides caching.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultGCacheSize = 100 * 100
	DefaultGCacheType = "lru"
)
View Source
var DefaultCacheExpire = time.Hour

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(interface{}) (interface{}, error)
	Has(interface{}) bool
	Set(interface{}, interface{}, time.Duration) error
	Purge() error
	Remove(interface{}) bool
	New() (Cache, error)
}

func NewCacheFromURI

func NewCacheFromURI(uri string) (Cache, error)

type Dummy

type Dummy struct{}

func (Dummy) Get

func (Dummy) Get(interface{}) (interface{}, error)

func (Dummy) Has

func (Dummy) Has(interface{}) bool

func (Dummy) New

func (Dummy) New() (Cache, error)

func (Dummy) Purge

func (Dummy) Purge() error

func (Dummy) Remove

func (Dummy) Remove(interface{}) bool

func (Dummy) Set

func (Dummy) Set(interface{}, interface{}, time.Duration) error

type GCache

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

func NewGCache

func NewGCache(tp string, size int, expire time.Duration) (*GCache, error)

func NewGCacheWithQuery

func NewGCacheWithQuery(config url.Values) (*GCache, error)

func (*GCache) Get

func (ca *GCache) Get(key interface{}) (interface{}, error)

func (*GCache) Has

func (ca *GCache) Has(key interface{}) bool

func (*GCache) New

func (ca *GCache) New() (Cache, error)

func (*GCache) Purge

func (ca *GCache) Purge() error

func (*GCache) Remove

func (ca *GCache) Remove(key interface{}) bool

func (*GCache) Set

func (ca *GCache) Set(key interface{}, b interface{}, expire time.Duration) error

func (*GCache) SetWithoutExpire

func (ca *GCache) SetWithoutExpire(key interface{}, b interface{}) error

func (*GCache) Traverse

func (ca *GCache) Traverse(callback func(k, v interface{}) bool) error

Jump to

Keyboard shortcuts

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