mcache

package
v0.0.0-...-11273d6 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 2 Imported by: 6

Documentation

Index

Constants

View Source
const (
	//NoExpiration :
	//Indicates cached object will never be expired
	NoExpiration = gocache.NoExpiration
	// DefaultExpiration :
	// The default value for expiration
	DefaultExpiration = gocache.DefaultExpiration
)

Default value for cache configuration noinspection GoUnusedConst

Variables

This section is empty.

Functions

This section is empty.

Types

type MemCache

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

func NewCache

func NewCache(defaultExpiration, cleanupInterval time.Duration) *MemCache

export

func NewEnsureCache

func NewEnsureCache(defaultExpiration, cleanupInterval time.Duration, resolver Resolver) *MemCache

export

func (*MemCache) EnsureGet

func (mc *MemCache) EnsureGet(key string) (interface{}, bool)

func (*MemCache) Get

func (mc *MemCache) Get(key string) (interface{}, bool)

func (*MemCache) GetStore

func (mc *MemCache) GetStore() *gocache.Cache

func (*MemCache) Remove

func (mc *MemCache) Remove(key string)

func (*MemCache) Set

func (mc *MemCache) Set(key string, value interface{})

func (*MemCache) SetOnEvicted

func (mc *MemCache) SetOnEvicted(f func(string, interface{}))

func (*MemCache) SetResolver

func (mc *MemCache) SetResolver(resovler Resolver)

func (*MemCache) TryGet

func (mc *MemCache) TryGet(key string) (interface{}, bool)

type Resolver

type Resolver func(key string) interface{}

Jump to

Keyboard shortcuts

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