lru

package
v0.0.0-...-f6732a9 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a simple implementation for the Least Recently Used (LRU) cache.

func NewCache

func NewCache(maxSize int) *Cache

NewCache returns a new Cache with specified max size.

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all cache content.

func (*Cache) Get

func (c *Cache) Get(key string) (int, bool)

Get fetch value from the cache.

func (*Cache) Put

func (c *Cache) Put(key string, value int)

Put stores a given key in the cache.

func (*Cache) Remove

func (c *Cache) Remove(key string)

Remove removes an item from the cache.

Jump to

Keyboard shortcuts

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