tlru

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: LGPL-3.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 TLRU

type TLRU[V any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TLRU - Time aware Least Recently Used cache

func New

func New[V any](size int, ttl time.Duration, stale bool) *TLRU[V]

New TLRU cache

func (*TLRU[V]) Get

func (c *TLRU[V]) Get(key string) V

Get an item from cache

func (*TLRU[V]) Has

func (c *TLRU[V]) Has(key string) bool

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

func (*TLRU[V]) Purge

func (c *TLRU[V]) Purge()

Purge cache

func (*TLRU[V]) Remove

func (c *TLRU[V]) Remove(key string)

Remove an item from cache

func (*TLRU[V]) Set

func (c *TLRU[V]) Set(key string, value V)

Set an item to cache

Jump to

Keyboard shortcuts

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