Registry / utility / patrickmn-go-cache

patrickmn-go-cache

JSON →
library2.1.0+incompatiblegogounverified

Provides an in-memory key:value store/cache similar to memcached, suitable for single-machine applications.

go get github.com/patrickmn/go-cache
INSTALL
IMPORT
SIG · PATRICKMN-GO-CACHE
P
patrickmn-go-cache
utilitygov2.1.0+incompatible
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cache
github.com/patrickmn/go-cache

Create a cache, set a key, and retrieve it.

package main import ( "fmt" "time" "github.com/patrickmn/go-cache" ) func main() { c := cache.New(5*time.Minute, 10*time.Minute) c.Set("foo", "bar", cache.DefaultExpiration) foo, found := c.Get("foo") if found { fmt.Println(foo) } }
Debug
Known issues
gotchago-cache is not thread-safe for concurrent writes; use sync.RWMutex if needed.
fix
Wrap cache operations with a mutex for concurrent access.
affects: *
Upgrade
Version history
2.1.0+incompatiblelatest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
patrickmn-go-cache — go get patrickmn-go-cache · libregistry