prunemap

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map struct {
	Evictions chan interface{}
	// contains filtered or unexported fields
}

Map is a map that self-prunes items based on a TTL.

func New

func New(itemTTL, pruneInterval time.Duration) *Map

New creates a new Map

func (*Map) Add

func (m *Map) Add(k string, n interface{})

Add adds an item to the map or updates the timestamp if the item already exists.

func (*Map) Close

func (m *Map) Close()

Close closes the map.

func (*Map) Get

func (m *Map) Get(k string) interface{}

Get gets a value from the map.

func (*Map) Remove

func (m *Map) Remove(k string)

Remove removes an item.

Jump to

Keyboard shortcuts

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