https://github.com/m7shapan/lfu-redis
LFU Redis implements LFU Cache algorithm using Redis as data storage
https://github.com/m7shapan/lfu-redis
cache lfu-cache redis
Last synced: 5 months ago
JSON representation
LFU Redis implements LFU Cache algorithm using Redis as data storage
- Host: GitHub
- URL: https://github.com/m7shapan/lfu-redis
- Owner: m7shapan
- License: mit
- Created: 2021-04-10T23:33:24.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-11T01:02:46.000Z (about 5 years ago)
- Last Synced: 2024-06-20T10:16:57.799Z (almost 2 years ago)
- Topics: cache, lfu-cache, redis
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# LFU Redis cache library for Golang
LFU Redis implements LFU Cache algorithm using Redis as data storage
LFU Redis Package gives you control over Cache Capacity in case you're using multipurpose Redis instance and avoid using eviction policy
## Installation
```bash
go get -u github.com/m7shapan/lfu-redis
```
## Quickstart
```go
package lfu_test
import (
"fmt"
"github.com/go-redis/redis/v8"
"github.com/m7shapan/lfu-redis"
)
func ExampleUsage() {
redisClient := redis.NewClient(&redis.Options{})
cache := lfu.New(10000, redisClient)
err := cache.Put("key", "value")
if err != nil {
panic(err)
}
value, err := cache.Get("key")
if err != nil {
panic(err)
}
fmt.Println(value)
// Output: value
}
```