godis alternatives and similar packages
Based on the "NoSQL Databases" category.
Alternatively, view godis alternatives based on common mentions on social networks and blogs.
-
qmgo
Qmgo - The Go driver for MongoDB. It‘s based on official mongo-go-driver but easier to use like Mgo. -
mgm
Mongo Go Models (mgm) is a fast and simple MongoDB ODM for Go (based on official Mongo Go Driver) -
go-rejson
Golang client for redislabs' ReJSON module with support for multilple redis clients (redigo, go-redis) -
godscache
An unofficial Google Cloud Platform Go Datastore wrapper that adds caching using memcached. For App Engine Flexible, Compute Engine, Kubernetes Engine, and more.
CodeRabbit: AI Code Reviews for Developers

Do you think we are missing an alternative of godis or a related project?
Popular Comparisons
README
godis
redis client implement by golang, refers to jedis.
this library implements most of redis command, include normal redis command, cluster command, sentinel command, pipeline command and transaction command.
if you've ever used jedis, then you can use godis easily, godis almost has the same method of jedis.
especially, godis implements distributed lock in single mode and cluster mode, godis's lock is much more faster than redisson, on my computer(i7,8core,32g), run 100,000 loop, use 8 threads, the business code is just count++, redisson need 18s-20s, while godis just need 7 second.
godis has done many test case to make sure it's stable.
I am glad you made any suggestions, and I will actively iterate over the project.
Features
- cluster
- pipeline
- transaction
- distributed lock
- other feature under development
Installation
go get -u github.com/piaohao/godis
or use go.mod
:
require github.com/piaohao/godis latest
Documentation
Quick Start
basic example
package main import ( "github.com/piaohao/godis" ) func main() { redis := godis.NewRedis(&godis.Option{ Host: "localhost", Port: 6379, Db: 0, }) defer redis.Close() redis.Set("godis", "1") arr, _ := redis.Get("godis") println(arr) }
use pool
package main import ( "github.com/piaohao/godis" ) func main() { option:=&godis.Option{ Host: "localhost", Port: 6379, Db: 0, } pool := godis.NewPool(&godis.PoolConfig{}, option) redis, _ := pool.GetResource() defer redis.Close() redis.Set("godis", "1") arr, _ := redis.Get("godis") println(arr) }
pubsub
package main import ( "github.com/piaohao/godis" "time" ) func main() { option:=&godis.Option{ Host: "localhost", Port: 6379, Db: 0, } pool := godis.NewPool(&godis.PoolConfig{}, option) go func() { redis, _ := pool.GetResource() defer redis.Close() pubsub := &godis.RedisPubSub{ OnMessage: func(channel, message string) { println(channel, message) }, OnSubscribe: func(channel string, subscribedChannels int) { println(channel, subscribedChannels) }, OnPong: func(channel string) { println("recieve pong") }, } redis.Subscribe(pubsub, "godis") }() time.Sleep(1 * time.Second) { redis, _ := pool.GetResource() defer redis.Close() redis.Publish("godis", "godis pubsub") redis.Close() } time.Sleep(1 * time.Second) }
cluster
package main import ( "github.com/piaohao/godis" "time" ) func main() { cluster := godis.NewRedisCluster(&godis.ClusterOption{ Nodes: []string{"localhost:7000", "localhost:7001", "localhost:7002", "localhost:7003", "localhost:7004", "localhost:7005"}, ConnectionTimeout: 0, SoTimeout: 0, MaxAttempts: 0, Password: "", PoolConfig: &godis.PoolConfig{}, }) cluster.Set("cluster", "godis cluster") reply, _ := cluster.Get("cluster") println(reply) }
pipeline
package main import ( "github.com/piaohao/godis" "time" ) func main() { option:=&godis.Option{ Host: "localhost", Port: 6379, Db: 0, } pool := godis.NewPool(&godis.PoolConfig{}, option) redis, _ := pool.GetResource() defer redis.Close() p := redis.Pipelined() infoResp, _ := p.Info() timeResp, _ := p.Time() p.Sync() timeList, _ := timeResp.Get() println(timeList) info, _ := infoResp.Get() println(info) }
transaction
package main import ( "github.com/piaohao/godis" "time" ) func main() { option:=&godis.Option{ Host: "localhost", Port: 6379, Db: 0, } pool := godis.NewPool(nil, option) redis, _ := pool.GetResource() defer redis.Close() p, _ := redis.Multi() infoResp, _ := p.Info() timeResp, _ := p.Time() p.Exec() timeList, _ := timeResp.Get() println(timeList) info, _ := infoResp.Get() println(info) }
distribute lock
single redis
package main import ( "github.com/piaohao/godis" "time" ) func main() { locker := godis.NewLocker(&godis.Option{ Host: "localhost", Port: 6379, Db: 0, }, &godis.LockOption{ Timeout: 5*time.Second, }) lock, err := locker.TryLock("lock") if err == nil && lock!=nil { //do something locker.UnLock(lock) } }
redis cluster
package main import ( "github.com/piaohao/godis" "time" ) func main() { locker := godis.NewClusterLocker(&godis.ClusterOption{ Nodes: []string{"localhost:7000", "localhost:7001", "localhost:7002", "localhost:7003", "localhost:7004", "localhost:7005"}, ConnectionTimeout: 0, SoTimeout: 0, MaxAttempts: 0, Password: "", PoolConfig: &godis.PoolConfig{}, },&godis.LockOption{ Timeout: 5*time.Second, }) lock, err := locker.TryLock("lock") if err == nil && lock!=nil { //do something locker.UnLock(lock) } }
License
godis
is licensed under the [MIT License](LICENSE), 100% free and open-source, forever.
Thanks
- [ jedis ] jedis is a popular redis client write by java
- [ gf ] gf is a amazing web framework write by golang
- [ go-commons-pool ] refers to apache comnmon-pool
Contact
*Note that all licence references and agreements mentioned in the godis README section above
are relevant to that project's source code only.