go-mcache alternatives and similar packages
Based on the "Data Structures" category.
Alternatively, view go-mcache alternatives based on common mentions on social networks and blogs.
-
golang-set
A simple, battle-tested and generic set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp. -
hyperloglog
HyperLogLog with lots of sugar (Sparse, LogLog-Beta bias correction and TailCut space reduction) brought to you by Axiom -
ttlcache
DISCONTINUED. An in-memory cache with item expiration and generics [Moved to: https://github.com/jellydator/ttlcache] -
Bloomfilter
DISCONTINUED. Face-meltingly fast, thread-safe, marshalable, unionable, probability- and optimal-size-calculating Bloom filter in go -
hilbert
DISCONTINUED. Go package for mapping values to and from space-filling curves, such as Hilbert and Peano curves. -
cuckoo-filter
Cuckoo Filter go implement, better than Bloom Filter, configurable and space optimized 布谷鸟过滤器的Go实现,优于布隆过滤器,可以定制化过滤器参数,并进行了空间优化 -
go-rquad
:pushpin: State of the art point location and neighbour finding algorithms for region quadtrees, in Go -
nan
Zero allocation Nullable structures in one library with handy conversion functions, marshallers and unmarshallers -
hide
A Go type to prevent internal numeric IDs from being exposed to clients using HashIDs and JSON.
InfluxDB - Purpose built for real-time analytics at any scale.
Do you think we are missing an alternative of go-mcache or a related project?
Popular Comparisons
README
MCache library
go-mcache - this is a fast key:value storage. Its major advantage is that, being essentially a thread-safe .
map[string]interface{}
with expiration times, it doesn't need to serialize, and quick removal of expired keys.
Installation
~ $ go get -u github.com/OrlovEvgeny/go-mcache
Example a Pointer value (vary fast method)
type User struct {
Name string
Age uint
Bio string
}
func main() {
//Start mcache instance
MCache = mcache.New()
//Create custom key
key := "custom_key1"
//Create example struct
user := &User{
Name: "John",
Age: 20,
Bio: "gopher 80 lvl",
}
//args - key, &value, ttl (or you need never delete, set ttl is mcache.TTL_FOREVER)
err := MCache.Set(key, user, time.Minute*20)
if err != nil {
log.Fatal(err)
}
if data, ok := MCache.Get(key); ok {
objUser:= data.(*User)
fmt.Printf("User name: %s, Age: %d, Bio: %s\n", objUser.Name, objUser.Age, objUser.Bio)
}
}
Performance Benchmarks
goos: darwin
goarch: amd64
BenchmarkWrite-4 200000 7991 ns/op
BenchmarkRead-4 1000000 1716 ns/op
BenchmarkRW-4 300000 9894 ns/op
What should be done
- [x] the possibility of closing
- [x] r/w benchmark statistics
- [ ] rejection of channels in safeMap in favor of sync.Mutex (there is an opinion that it will be faster)
License:
[MIT](LICENSE)
*Note that all licence references and agreements mentioned in the go-mcache README section above
are relevant to that project's source code only.