Onecache
One caching API, Multiple backends
Install / Use
/learn @adelowo/OnecacheREADME
OneCache - A Go caching Library
<div id="install"></div>Installation
$ go get -u github.com/adelowo/onecache
<div id="stores"></div>
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
<div id="eg"></div>Examples containing all adapters can be found here
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
Related Skills
node-connect
341.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
341.2kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
84.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
