tlru

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: LGPL-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 TLRU

type TLRU struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TLRU - Time aware Least Recently Used cache

func New

func New(size int, ttl time.Duration, stale bool) *TLRU

New TLRU cache

func (*TLRU) Get

func (c *TLRU) Get(key interface{}) interface{}

Get an item from cache

func (*TLRU) Has

func (c *TLRU) Has(key interface{}) bool

Has check if an item exists in cache, without useness update

func (*TLRU) Purge

func (c *TLRU) Purge()

Purge cache

func (*TLRU) Remove

func (c *TLRU) Remove(key interface{})

Remove an item from cache

func (*TLRU) Set

func (c *TLRU) Set(key interface{}, value interface{})

Set an item to cache

Jump to

Keyboard shortcuts

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