Popularity
6.3
Growing
Activity
2.9
Declining
359
5
51
Programming language: Go
License: GNU General Public License v3.0 or later
Tags:
Distributed Systems
Latest version: v0.7.0
redis-lock alternatives and similar packages
Based on the "Distributed Systems" category.
Alternatively, view redis-lock alternatives based on common mentions on social networks and blogs.
-
tendermint
High-performance middleware for transforming a state machine written in any programming language into a Byzantine Fault Tolerant replicated state machine using the Tendermint consensus and blockchain protocols. -
gleam
Fast and scalable distributed map/reduce system written in pure Go and Luajit, combining Go's high concurrency with Luajit's high performance, runs standalone or distributed. -
glow
Easy-to-Use scalable distributed big data processing, Map-Reduce, DAG execution, all in pure Go. -
emitter-io
High performance, distributed, secure and low latency publish-subscribe platform built with MQTT, Websockets and love. -
Olric
Distributed cache and key/value store. It can be used both as an embedded Go library and as a language-independent service. -
go-sundheit
A library built to provide support for defining async service health checks for golang services. -
celeriac
A library for adding support for interacting and monitoring Celery workers, tasks and events in Go -
go-zero
A web and rpc framework. It's born to ensure the stability of the busy sites with resilient design. Builtin goctl greatly improves the development productivity.
Get performance insights in less than 4 minutes
Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.
Sponsored
scoutapm.com
Do you think we are missing an alternative of redis-lock or a related project?
Popular Comparisons
README
redislock
Simplified distributed locking implementation using Redis. For more information, please see examples.
Examples
import (
"fmt"
"time"
"github.com/bsm/redislock"
"github.com/go-redis/redis/v8"
)
func main() {
// Connect to redis.
client := redis.NewClient(&redis.Options{
Network: "tcp",
Addr: "127.0.0.1:6379",
})
defer client.Close()
// Create a new lock client.
locker := redislock.New(client)
ctx := context.Background()
// Try to obtain lock.
lock, err := locker.Obtain(ctx, "my-key", 100*time.Millisecond, nil)
if err == redislock.ErrNotObtained {
fmt.Println("Could not obtain lock!")
} else if err != nil {
log.Fatalln(err)
}
// Don't forget to defer Release.
defer lock.Release(ctx)
fmt.Println("I have a lock!")
// Sleep and check the remaining TTL.
time.Sleep(50 * time.Millisecond)
if ttl, err := lock.TTL(ctx); err != nil {
log.Fatalln(err)
} else if ttl > 0 {
fmt.Println("Yay, I still have my lock!")
}
// Extend my lock.
if err := lock.Refresh(ctx, 100*time.Millisecond, nil); err != nil {
log.Fatalln(err)
}
// Sleep a little longer, then check.
time.Sleep(100 * time.Millisecond)
if ttl, err := lock.TTL(ctx); err != nil {
log.Fatalln(err)
} else if ttl == 0 {
fmt.Println("Now, my lock has expired!")
}
}
Documentation
Full documentation is available on GoDoc
*Note that all licence references and agreements mentioned in the redis-lock README section above
are relevant to that project's source code only.