https://github.com/git-hulk/go-lru
golang LRU cache
https://github.com/git-hulk/go-lru
Last synced: 9 months ago
JSON representation
golang LRU cache
- Host: GitHub
- URL: https://github.com/git-hulk/go-lru
- Owner: git-hulk
- License: apache-2.0
- Created: 2017-02-06T06:27:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-10-29T02:19:18.000Z (over 6 years ago)
- Last Synced: 2024-11-01T08:42:20.282Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 13
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-lru [](https://goreportcard.com/report/github.com/git-hulk/go-lru) [](https://travis-ci.org/git-hulk/go-lru)
go-lru is an MIT-licensed Go LRU cache bases on GroupCache, with expire time supported
## Example
Set key with expire time
```
cache := NewCache(100) // max entries in cache is 100
cache.Set("a", 1234, 1) // key "a" would be expired after 1 second
```
Set key without expire time
```
cache := NewCache(100)
cache.Set("a", 1234) // set key "a" without expire time
```
## API doc
API documentation is available via [https://godoc.org/github.com/git-hulk/go-lru](https://godoc.org/github.com/git-hulk/go-lru)