### OneCache - A Go caching Library [](https://coveralls.io/github/adelowo/onecache) [](https://travis-ci.org/adelowo/onecache.svg?branch=master) - [Installation](#install) - [Supported stores](#stores) - [Examples](#eg)
### Installation ```go $ go get -u github.com/adelowo/onecache ``` Supported cache stores - [x] InMemory - [x] Filesystem - [x] Memcached - [x] Redis OneCache also comes with ___garbage collection___. This is used by the filesystem and memory adapter to purge out expired items automatically. Please refer to the [examples][eg] [Examples containing all adapters can be found here][eg] ```go var store onecache.Store store = filesystem.MustNewFSStore("/home/adez/onecache_tmp") err := store.Set("profile", []byte("Lanre"), time.Second*60) if err != nil { fmt.Println(err) return } value,err := store.Get("profile") if err != nil { fmt.Println(err) return } fmt.Println(string(value)) ``` Some adapters like the `filesystem` and `memory` have a ___Garbage collection___ implementation. All that is needed to call is `store.GC()`. Ideally, this should be called in a `ticker.C`. ### LICENSE MIT [eg]: https://github.com/adelowo/onecache/blob/master/_examples/main.go