cache

package
v0.0.0-...-654a8ab Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvictionNotice

type EvictionNotice func(string, payload.Payload)

EvictionNotice is invoked when an entry is evicted from the cache.

type Interface

type Interface interface {
	Get(string) (payload.Payload, bool)

	Add(string, payload.Payload)

	Purge()
}

func NewLRU

func NewLRU(capacity int, notify EvictionNotice) Interface

NewLRU creates a thread-safe cache with LRU as its eviction policy. Entries are evicted when the size is about to exceed the capacity. EvictionNotice callback is used whenever an entry is being evicted.

Jump to

Keyboard shortcuts

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