Go缓存库:LRUCache

jopen 9年前

用 Go 编写的一个简单的 LRUCache 库,示例代码:

// define a type that can be used with the cache  type myCacheableValue struct {  }     func (v *myCacheableValue) Size() uint64 {      return 64  }     // create a LRUCache  cache := lrucache.New(1989)     // put value to the cache  value := myCacheableValue{}  cache.Set("key", value)     // get value from the cache  v, ok := cache.Get("key")

项目主页:http://www.open-open.com/lib/view/home/1421632566234