lfu

package
v0.0.0-...-4ff26d5 Latest Latest
Warning

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

Go to latest
Published: May 4, 2014 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

This package implements a O(1) LFU Followed the origin paper http://dhruvbird.com/lfu.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func New

func New(o *Option) *Cache

func (*Cache) Capacity

func (c *Cache) Capacity() uint64

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) Delete

func (c *Cache) Delete(key cache.Key)

func (*Cache) ElementsCount

func (c *Cache) ElementsCount() uint64

func (*Cache) Evict

func (c *Cache) Evict(n int)

func (*Cache) Get

func (c *Cache) Get(key cache.Key) (cache.Data, bool)

func (*Cache) Set

func (c *Cache) Set(key cache.Key, data cache.Data)

func (*Cache) SetCapacity

func (c *Cache) SetCapacity(capacity uint64)

func (*Cache) Size

func (c *Cache) Size() uint64

type Option

type Option struct {
	Capacity    uint64
	MaxElements uint64
}

Jump to

Keyboard shortcuts

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