用Go编写的一个简单的LRUCache库,示例代码:
// defie a type that ca be used with the cachetype myCacheableValue struct {}fuc (v *myCacheableValue) Size() uit64 { retur 64}// create a LRUCachecache := lrucache.New(1989)// put value to the cachevalue := myCacheableValue{}cache.Set("key", value)// get value from the cachev, ok := cache.Get("key")点击空白处退出提示
评论