tinylfu

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 5 Imported by: 26 modules, 26 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址