Categorygithub.com/hashicorp/golang-lru
modulepackage
1.0.2
Repository: https://github.com/hashicorp/golang-lru.git
Documentation: pkg.go.dev

# README

golang-lru

Please upgrade to github.com/hashicorp/golang-lru/v2 for all new code as v1 will not be updated anymore. The v2 version supports generics and is faster; old code can specify a specific tag, e.g. github.com/hashicorp/golang-lru/v1.0.2 for backwards compatibility.

# Packages

Package simplelru provides simple LRU implementation based on build-in container/list.

# Functions

New creates an LRU of the given size.
New2Q creates a new TwoQueueCache using the default values for the parameters.
New2QParams creates a new TwoQueueCache using the provided parameter values.
NewARC creates an ARC of the given size.
NewWithEvict constructs a fixed size cache with the given eviction callback.

# Constants

Default2QGhostEntries is the default ratio of ghost entries kept to track entries recently evicted.
Default2QRecentRatio is the ratio of the 2Q cache dedicated to recently added entries that have only been accessed once.
DefaultEvictedBufferSize defines the default buffer size to store evicted key/val.

# Structs

ARCCache is a thread-safe fixed size Adaptive Replacement Cache (ARC).
Cache is a thread-safe fixed size LRU cache.
TwoQueueCache is a thread-safe fixed size 2Q cache.