tinylfu

package module
v0.0.0-...-5cb4011 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tinylfu is an implementation of the TinyLFU caching algorithm

http://arxiv.org/abs/1512.00727

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Key      string
	Value    interface{}
	ExpireAt time.Time
	OnEvict  func()
	// contains filtered or unexported fields
}

type SyncT

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

func NewSync

func NewSync(size int, samples int) *SyncT

func (*SyncT) Del

func (t *SyncT) Del(key string)

func (*SyncT) Get

func (t *SyncT) Get(key string) (interface{}, bool)

func (*SyncT) Set

func (t *SyncT) Set(item *Item)

type T

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

func New

func New(size int, samples int) *T

func (*T) Del

func (t *T) Del(key string)

func (*T) Get

func (t *T) Get(key string) (interface{}, bool)

func (*T) Set

func (t *T) Set(newItem *Item)

Jump to

Keyboard shortcuts

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