simpleLru

package
v0.0.0-...-d9d11fa Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config LruConfig) *simpleCache

Types

type CacheValue

type CacheValue interface {
	Len() int
}

type LRU

type LRU interface {
	Get(key string) (value CacheValue, ok bool)
	Set(key string, value CacheValue)
	Purge()
	Contains(key string) (ok bool)
	Len() int
	Delete(key string)
	GetCursor(key string) (index int)
}

type LruConfig

type LruConfig struct {
	Evicted   func(key string, value CacheValue)
	MaxBytes  int
	IsHistory bool
	IsFIFO    bool
	WaitTime  time.Duration
}

Jump to

Keyboard shortcuts

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