芒果缓存
Go 中部分实现。
支持的缓存替换策略:
LRU
分段 LRU(默认)
TinyLFU(实验性)
TinyLFU 实现的灵感来自 Ben Manes 的和 Damian Gryski 的 tinylfu。
下载
go get -u github.com/goburrow/cache
例子
package main
import (
"fmt"
"math/rand"
"time"
"github.com/goburrow/cache"
)
func main () {
load := func ( k cache. Key ) (cache. Value , error ) {
time . Sleep ( 100 * time . Millisecond ) // Slow task
return fmt . Sprintf ( "%d" ,
, 相关下载链接:
https://download.csdn.net/download/weixin_42116701/20444380?utm_source=bbsseo