luxcache

package
v0.15.45 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: GPL-3.0, LGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package luxcache provides backward compatibility types for cache that were present in older Lux versions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LRU

type LRU[K comparable, V any] struct {
	Size int
	// contains filtered or unexported fields
}

LRU provides a backward compatibility type for cache.LRU In newer Lux versions, use cache/lru.Cache instead

func NewLRU

func NewLRU[K comparable, V any](size int) *LRU[K, V]

NewLRU creates a new LRU cache with initialization

func (*LRU[K, V]) Evict

func (l *LRU[K, V]) Evict(key K)

Evict removes a key

func (*LRU[K, V]) Flush

func (l *LRU[K, V]) Flush()

Flush removes all entries

func (*LRU[K, V]) Get

func (l *LRU[K, V]) Get(key K) (V, bool)

Get returns the value for a key

func (*LRU[K, V]) Len

func (l *LRU[K, V]) Len() int

Len returns the number of elements

func (*LRU[K, V]) PortionFilled

func (l *LRU[K, V]) PortionFilled() float64

PortionFilled returns the fraction of cache filled

func (*LRU[K, V]) Put

func (l *LRU[K, V]) Put(key K, value V)

Put adds a key-value pair

Jump to

Keyboard shortcuts

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