⚡Modified from https://github.com/fanjindong/go-cache with Generics in Go 1.18+.
- Go 100%
| .gitattributes | ||
| .gitignore | ||
| cache.go | ||
| cache_test.go | ||
| config.go | ||
| go.mod | ||
| hash.go | ||
| item.go | ||
| LICENSE | ||
| option.go | ||
| README.md | ||
| shard.go | ||
go-cache
Modified from https://github.com/fanjindong/go-cache with Generics in Go 1.18+.
Install
go get -u codeberg.org/alist/go-cache
Basic Usage
import "codeberg.org/alist/go-cache"
func main() {
c := cache.NewMemCache[int]()
c.Set("a", 1)
c.Set("b", 1, cache.WithEx[int](1*time.Second))
time.sleep(1*time.Second)
c.Get("a") // 1, true
c.Get("b") // nil, false
}