You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
icache is a cache library for Go with high concurrent access performance.
Its major advantages over the other libraries is that it doesn't serialize
your data and only stores values. As the result you won't need to unmarshal
anything when you get the values from it. This saves you time and resources.
Any object can be stored, for a given duration or forever, and the cache
can be safely used by multiple goroutines.
Any object can be stored, for a given duration or forever, and the cache
can be safely used by multiple goroutines.
Installation
go get github.com/mdaliyan/icache
Usage
// make na new Pot with the default expiration time of 1 Hour// set ttl to 0 to disable expiration entirelyvarpot=icache.NewPot(time.Hour)
varU=user{
ID: "foo",
Name: "John Doe",
Age: 30,
}
// set user to "foo" keypot.Set("foo", U)
// get the user previously set to "foo" key into u2 varu2usererr=pot.Get("foo", &u2)
// if you pass a mismatched type you simply get a "type mismatch" errorvaru3stringerr=pot.Get("foo", &u3)
// you also can add tags to your entriespot.Set("foo", U, "tag1", "tag2")
pot.Set("faa", U, "tag1")
pot.Set("fom", U, "tag3")
// and delete multiple entries at oncepot.DropTags("tag1")
I might add MGet method later
About
A High Performance, Generic, thread-safe, zero-dependency, key-value, in-memory cache