SkillAgentSearch skills...

Onecache

One caching API, Multiple backends

Install / Use

/learn @adelowo/Onecache
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

OneCache - A Go caching Library

Coverage Status Build Status

<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

View on GitHub
GitHub Stars135
CategoryDevelopment
Updated5mo ago
Forks8

Languages

Go

Security Score

97/100

Audited on Oct 6, 2025

No findings