remember-go alternatives and similar packages
Based on the "Data Structures" category.
Alternatively, view remember-go alternatives based on common mentions on social networks and blogs.
-
gods
GoDS (Go Data Structures) - Sets, Lists, Stacks, Maps, Trees, Queues, and much more -
go-datastructures
A collection of useful, performant, and threadsafe Go datastructures. -
golang-set
A simple, battle-tested and generic set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp. -
roaring
Roaring bitmaps in Go (golang), used by InfluxDB, Bleve, DataDog -
willf/bloom
Go package implementing Bloom filters, used by Milvus and Beego. -
gocache
☔️ A complete Go cache library that brings you multiple ways of managing your caches -
boomfilters
Probabilistic data structures for processing continuous, unbounded streams. -
gostl
Data structure and algorithm library for go, designed to provide functions similar to C++ STL -
hyperloglog
HyperLogLog with lots of sugar (Sparse, LogLog-Beta bias correction and TailCut space reduction) brought to you by Axiom -
trie
Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching. -
ttlcache
An in-memory cache with item expiration and generics [Moved to: https://github.com/jellydator/ttlcache] -
go-geoindex
Go native library for fast point tracking and K-Nearest queries -
go-adaptive-radix-tree
Adaptive Radix Trees implemented in Go -
Bloomfilter
Face-meltingly fast, thread-safe, marshalable, unionable, probability- and optimal-size-calculating Bloom filter in go -
hilbert
Go package for mapping values to and from space-filling curves, such as Hilbert and Peano curves. -
goconcurrentqueue
Go concurrent-safe, goroutine-safe, thread-safe queue -
cuckoo-filter
Cuckoo Filter go implement, better than Bloom Filter, configurable and space optimized 布谷鸟过滤器的Go实现,优于布隆过滤器,可以定制化过滤器参数,并进行了空间优化 -
ring
Package ring provides a high performance and thread safe Go implementation of a bloom filter. -
go-rquad
:pushpin: State of the art point location and neighbour finding algorithms for region quadtrees, in Go -
set
A simple Set data structure implementation in Go (Golang) using LinkedHashMap. -
nan
Zero allocation Nullable structures in one library with handy conversion functions, marshallers and unmarshallers -
goset
Set is a useful collection but there is no built-in implementation in Go lang. -
hide
ID type with marshalling to/from hash to prevent sending IDs to clients.
WorkOS - The modern identity platform for B2B SaaS
Do you think we are missing an alternative of remember-go or a related project?
README
Cache Slow Database Queries
This package is used to cache the results of slow database queries in memory or Redis. It can be used to cache any form of data. A Redis and in-memory storage driver is provided.
See Article for further details including a tutorial.
The package is production ready and the API is stable. A variant of this package has been used in production for over 3 years.
⭐ the project to show your appreciation.
Installation
go get -u github.com/rocketlaunchr/remember-go
Create a Key
Let’s assume the query’s argument is an arbitrary search
term and a page
number for pagination.
CreateKeyStruct
CreateKeyStruct can generate a JSON based key by providing a struct.
type Key struct {
Search string
Page int `json:"page"`
}
var key string = remember.CreateKeyStruct(Key{"golang", 2})
CreateKey
CreateKey provides more flexibility to generate keys:
// Key will be "search-golang-2"
key := remember.CreateKey(false, "-", "search-x-y", "search", "golang", 2)
Initialize the Storage Driver
In-Memory
import "github.com/rocketlaunchr/remember-go/memory"
var ms = memory.NewMemoryStore(10 * time.Minute)
Redis
The Redis storage driver relies on Gary Burd’s excellent Redis client library.
import red "github.com/rocketlaunchr/remember-go/redis"
import "github.com/gomodule/redigo/redis"
var rs = red.NewRedisStore(&redis.Pool{
Dial: func() (redis.Conn, error) {
return redis.Dial("tcp", "localhost:6379")
},
})
Memcached
An experimental (and untested) memcached driver is provided. It relies on Brad Fitzpatrick's memcache driver.
Ristretto
DGraph's Ristretto is a fast, fixed size, in-memory cache with a dual focus on throughput and hit ratio performance.
Create a SlowRetrieve Function
The package initially checks if data exists in the cache. If it doesn’t, then it elegantly fetches the data directly from the database by calling the SlowRetrieve
function. It then saves the data into the cache so that next time it doesn’t have to refetch it from the database.
type Result struct {
Title string
}
slowQuery := func(ctx context.Context) (interface{}, error) {
results := []Result{}
stmt := `
SELECT title
FROM books WHERE title LIKE ?
ORDER BY title LIMIT ?, 20
`
rows, _ := db.QueryContext(ctx, stmt, search, (page-1)*20)
for rows.Next() {
var title string
rows.Scan(&title)
results = append(results, Result{title})
}
return results, nil
}
Usage
key := remember.CreateKeyStruct(Key{"golang", 2})
exp := 10*time.Minute
results, found, err := remember.Cache(ctx, ms, key, exp, slowQuery, remember.Options{GobRegister: false})
return results.([]Result) // Type assert in order to use
Gob Register Errors
The Redis storage driver stores the data in a gob
encoded form. You have to register with the gob
package the data type returned by the SlowRetrieve
function. It can be done inside a func init()
. Alternatively, you can set the GobRegister
option to true. This will slightly impact concurrency performance however.
Other useful packages
- dataframe-go - For statistics, machine-learning, and data manipulation/exploration
- dbq - Zero boilerplate database operations for Go
- electron-alert - SweetAlert2 for Electron Applications
- igo - A Go transpiler with cool new syntax such as fordefer (defer for for-loops)
- mysql-go - Properly cancel slow MySQL queries
- react - Build front end applications using Go
Legal Information
The license is a modified MIT license. Refer to LICENSE
file for more details.
© 2019-20 PJ Engineering and Business Solutions Pty. Ltd.
Final Notes
Feel free to enhance features by issuing pull-requests.
*Note that all licence references and agreements mentioned in the remember-go README section above
are relevant to that project's source code only.