https://github.com/solutionstack/lcache
A simple LRU based cache in Go
https://github.com/solutionstack/lcache
Last synced: 4 months ago
JSON representation
A simple LRU based cache in Go
- Host: GitHub
- URL: https://github.com/solutionstack/lcache
- Owner: solutionstack
- License: gpl-3.0
- Created: 2022-06-29T02:45:57.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-29T21:12:42.000Z (almost 3 years ago)
- Last Synced: 2024-12-31T17:47:15.083Z (6 months ago)
- Language: Go
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lcache
Cache library for golang. It supports LFU currently.
## Features
* Supports LFU.
* Goroutine safe.
## Install
```
$ go get github.com/solutionstack/lcache
```## Example
### Set a key-value pair.
```go
package mainimport (
"github.com/solutionstack/lcache"
"fmt"
)func main() {
lc := lcache.NewCache(20) //optional size parameter to NewCache
lc.Write("key", "ok")
result := lc.Read("key")
if result.Error != nil {
panic( result.Error )
}
fmt.Println("Read:", result.Value)
}```
# Author
**Olubodn Agbalaya**
*
*