cache

package module
v0.0.0-...-34023c5 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2014 License: MIT Imports: 1 Imported by: 0

README

A go implemementation of Aadaptive Replacement Cache (ARC)

In performance, ARC is at least as good as LRU, and better in most real-world workloads.

The original algorithm is presented in the paper: http://www.almaden.ibm.com/cs/people/dmodha/arclogin.pdf. We adapt the algorithm to support caching objects with different memory sizes.

The original algorithm is implemented in the "classic" branch.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CacheMiss = errors.New("miss")
View Source
var EmptyKey = errors.New("empty key")
View Source
var ObjectTooBig = errors.New("object too big to fit in the cache")

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(string, CacheObject) error
	Get(string) (CacheObject, error)
	Delete(string) error
	Check()
	Collect() map[string]CacheObject
	SetCleanFunc(CacheCleanFunc)
	GetHitRate() int
	GetUsage() int
	GetUsageRate() int
	Reset()
}

type CacheCleanFunc

type CacheCleanFunc func(CacheObject) error

type CacheObject

type CacheObject interface {
	Size() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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