Package mcache provides a thread-safe in-memory cache, for the Go programming language.
Find a file
2025-09-02 03:50:10 -07:00
cacher.go span 2025-08-24 13:34:46 -07:00
go.mod mcache.TTLCacher[T].GetTTL() 2025-09-02 03:48:56 -07:00
go.sum mcache.TTLCacher[T].GetTTL() 2025-09-02 03:48:56 -07:00
hash.go hash() 2025-08-24 04:27:09 -07:00
hash_test.go hash() 2025-08-24 04:27:09 -07:00
LICENSE initial commits 2025-08-24 04:15:51 -07:00
newttl.go fixed vacuum 2025-08-24 20:32:24 -07:00
newttl_test.go added TTL to caching 2025-08-24 08:24:15 -07:00
README.md added TTL to caching 2025-08-24 08:24:15 -07:00
shardnumber.go shardNumber() 2025-08-24 04:37:48 -07:00
ttlcache.go mcache.TTLCacher[T].GetTTL() 2025-09-02 03:50:10 -07:00
ttlcache_setgetunset_test.go span 2025-08-24 13:33:08 -07:00
ttlcache_vacuum_test.go fixed vacuum 2025-08-24 20:32:24 -07:00
ttlcacher.go mcache.TTLCacher[T].GetTTL() 2025-09-02 03:48:56 -07:00
ttlshard.go added TTL to caching 2025-08-24 08:24:15 -07:00

go-mcache

Package mcache provides a thread-safe in-memory cache, for the Go programming language.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-mcache

GoDoc

Examples

Here is an example of using mcache:

import "github.com/reiver/go-mcache"

// ...

var defaultTTL time.Duration = 5 * time.Minute

cache := mcache.NewTTL[Type](defaultTTL)
if nil == cache {
	return errors.New("nil cache")
}

// ...

cache.Set(key, value)

// ...

val, found := cache.Get(name)

Import

To import package mcache use import code like the following:

import "github.com/reiver/go-mcache"

Installation

To install package mcache do the following:

GOPROXY=direct go get github.com/reiver/go-mcache

Author

Package mcache was written by Charles Iliya Krempeaux