cache

package
v0.0.0-...-0fffc3b Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store interface {
	Get(key interface{}) (interface{}, bool)
	Set(key, value interface{})
	Size() int
	SetNotExist(key interface{}, newValGenerator func() interface{}) (interface{}, bool)
}

Store represts a cache instance.

func NewLRU

func NewLRU(size int) Store

NewLRU creates a LRU memory cache, which is safe for concurrent access.

func NewLRUWithOnEvictedCallback

func NewLRUWithOnEvictedCallback(size int, onEvicted func(key, value interface{})) Store

NewLRUWithOnEvictedCallback creates a LRU memory cache with a OnEvicted callback

Jump to

Keyboard shortcuts

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