cache

package
v0.0.0-...-69e45e2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2015 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

キャッシュ。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// 入れる。
	Put(key, val, prio interface{})
	// 取り出す。
	Get(key interface{}) (val, prio interface{})
	// 優先度を変えつつ取り出す。LRU のとき使う。
	Update(key, prio interface{}) (val interface{})
	// 基準以下を削除。
	// 優先度 nil はいかなる非 nil な優先度より低いとする。
	// よって、Update で優先度を nil にしてから、CleanLower すれば削除できる。
	// nil で CleanLower したときは優先度 nil のものだけを削除する。
	CleanLower(prioThres interface{})
}

キャッシュ。

func New

func New(less func(interface{}, interface{}) bool) Cache

スレッドセーフではないキャッシュを返す。 less は非 nil の優先度 2 つを比べる関数。優先度 nil に対する挙動は指定できない。

Jump to

Keyboard shortcuts

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