cache

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: BSD-2-Clause Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	GetIfPresent(key string) interface{}
	Delete(key string)
	Get(key string, callback func() interface{}) interface{}
	Put(key string, value interface{})
}

type ExpirationCache

type ExpirationCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewExpirationCache

func NewExpirationCache(timeout time.Duration, interval time.Duration) *ExpirationCache

func (*ExpirationCache) Delete

func (this *ExpirationCache) Delete(key string)

func (*ExpirationCache) Get

func (this *ExpirationCache) Get(key string, callback func() interface{}) interface{}

func (*ExpirationCache) GetIfPresent

func (this *ExpirationCache) GetIfPresent(key string) interface{}

func (*ExpirationCache) GetIfPresentAndTouch

func (this *ExpirationCache) GetIfPresentAndTouch(key string) interface{}

func (*ExpirationCache) GetWithDuration

func (this *ExpirationCache) GetWithDuration(key string, callback func() interface{}, duration time.Duration) interface{}

func (*ExpirationCache) Put

func (this *ExpirationCache) Put(key string, value interface{})

func (*ExpirationCache) PutWithDuration

func (this *ExpirationCache) PutWithDuration(key string, value interface{}, duration time.Duration)

put a value in the cache, overwriting any previous value for that key

func (*ExpirationCache) Touch

func (this *ExpirationCache) Touch(key string)

func (*ExpirationCache) TouchWithDuration

func (this *ExpirationCache) TouchWithDuration(key string, duration time.Duration)

type LRUCache

type LRUCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLRUCache

func NewLRUCache(capacity int) *LRUCache

func (*LRUCache) Delete

func (this *LRUCache) Delete(key string)

func (*LRUCache) Get

func (this *LRUCache) Get(key string, callback func() interface{}) (interface{}, bool)

func (*LRUCache) GetIfPresent

func (this *LRUCache) GetIfPresent(key string) (interface{}, bool)

func (*LRUCache) Put

func (this *LRUCache) Put(key string, value interface{})

Jump to

Keyboard shortcuts

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