One caching API, Multiple backends
Clone or download
adelowo use os#IsNotExist to detect non existent files Don't open files just …
…to check if it exists, use os

#Stat instead
Latest commit 4fec6d7 Aug 29, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_examples
filesystem
memcached
memory
redis
.gitignore Make use of glide to manage dependencies Apr 27, 2017
.travis.yml
CHANGELOG.MD
LICENSE
Makefile
README.MD updted docs [ci skip] Mar 13, 2018
docker-compose.yml
go.mod Added support for modules Aug 28, 2018
go.sum
types.go
types_test.go
utils.go Updated docs May 28, 2017
utils_test.go

README.MD

OneCache - A Go caching Library

Coverage Status Build Status

Installation

$ go get -u github.com/adelowo/onecache

Supported cache stores

  • InMemory
  • Filesystem
  • Memcached
  • 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

Examples containing all adapters can be found here

var store onecache.Store

store = filesystem.MustNewFSStore("/home/adez/onecache_tmp", time.Minute*10)

err := store.Set("profile", []byte("Lanre"), time.Second*60)

fmt.Println(err)

fmt.Println(store.Get("profile"))

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