lfu

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

lfu (least frequently counter) will overwrite cached items that have been counter the least when the cache limit is reached.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheItem

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

CacheItem ...

func NewCacheItem

func NewCacheItem(content interface{}) *CacheItem

NewCacheItem ...

func (*CacheItem) Object

func (i *CacheItem) Object() interface{}

Object ...

func (*CacheItem) Set

func (i *CacheItem) Set(v interface{})

Set ...

type CacheList

type CacheList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCacheList

func NewCacheList(size uint) *CacheList

NewCacheList ...

func (*CacheList) Cap added in v0.8.4

func (list *CacheList) Cap() uint

func (*CacheList) ClearHard added in v0.8.4

func (list *CacheList) ClearHard()

func (*CacheList) ClearSoft added in v0.8.4

func (list *CacheList) ClearSoft()

func (*CacheList) ClearTableNils added in v0.8.4

func (list *CacheList) ClearTableNils()

func (*CacheList) ClearTables added in v0.8.4

func (list *CacheList) ClearTables()

func (*CacheList) CreateCacheableItem

func (list *CacheList) CreateCacheableItem(content interface{}) interfaces.CacheableItem

CreateCacheableItem ...

func (*CacheList) Delete

func (list *CacheList) Delete(id Snowflake)

Delete ...

func (*CacheList) Efficiency

func (list *CacheList) Efficiency() float64

Efficiency ...

func (*CacheList) Get

func (list *CacheList) Get(id Snowflake) (ret interfaces.CacheableItem, exists bool)

Get get an content from the list.

func (*CacheList) RefreshAfterDiscordUpdate

func (list *CacheList) RefreshAfterDiscordUpdate(itemI interfaces.CacheableItem)

RefreshAfterDiscordUpdate ...

func (*CacheList) Set

func (list *CacheList) Set(id Snowflake, newItemI interfaces.CacheableItem)

Set set adds a new content to the list or returns false if the content already exists

func (*CacheList) Size added in v0.8.4

func (list *CacheList) Size() uint

type Snowflake

type Snowflake = snowflake.Snowflake

Jump to

Keyboard shortcuts

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