{"id":37148435,"url":"https://github.com/netdata/redsync","last_synced_at":"2026-01-14T17:31:57.259Z","repository":{"id":65978479,"uuid":"416264247","full_name":"netdata/redsync","owner":"netdata","description":"Distributed mutual exclusion lock using Redis for Go","archived":false,"fork":true,"pushed_at":"2023-04-04T00:20:58.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T18:00:09.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://redis.io/topics/distlock","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"go-redsync/redsync","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-12T09:13:31.000Z","updated_at":"2021-10-12T09:13:34.000Z","dependencies_parsed_at":"2023-02-19T19:16:10.577Z","dependency_job_id":null,"html_url":"https://github.com/netdata/redsync","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/netdata/redsync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netdata%2Fredsync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netdata%2Fredsync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netdata%2Fredsync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netdata%2Fredsync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netdata","download_url":"https://codeload.github.com/netdata/redsync/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netdata%2Fredsync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28428275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T17:31:56.377Z","updated_at":"2026-01-14T17:31:57.254Z","avatar_url":"https://github.com/netdata.png","language":null,"readme":"# Redsync\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/go-redsync/redsync/v4.svg)](https://pkg.go.dev/github.com/go-redsync/redsync/v4) [![Build Status](https://travis-ci.org/go-redsync/redsync.svg?branch=master)](https://travis-ci.org/go-redsync/redsync) \n\nRedsync provides a Redis-based distributed mutual exclusion lock implementation for Go as described in [this post](http://redis.io/topics/distlock). A reference library (by [antirez](https://github.com/antirez)) for Ruby is available at [github.com/antirez/redlock-rb](https://github.com/antirez/redlock-rb).\n\n## Installation\n\nInstall Redsync using the go get command:\n\n    $ go get github.com/go-redsync/redsync/v4\n\nTwo driver implementations will be installed; however, only the one used will be included in your project.\n\n * [Redigo](https://github.com/gomodule/redigo)\n * [Go-redis](https://github.com/go-redis/redis)\n\nSee the [examples](examples) folder for usage of each driver.\n\n## Documentation\n\n- [Reference](https://godoc.org/github.com/go-redsync/redsync)\n\n## Usage\n\nError handling is simplified to `panic` for shorter example.\n\n```go\npackage main\n\nimport (\n\tgoredislib \"github.com/go-redis/redis/v8\"\n\t\"github.com/go-redsync/redsync/v4\"\n\t\"github.com/go-redsync/redsync/v4/redis/goredis/v8\"\n)\n\nfunc main() {\n\t// Create a pool with go-redis (or redigo) which is the pool redisync will\n\t// use while communicating with Redis. This can also be any pool that\n\t// implements the `redis.Pool` interface.\n\tclient := goredislib.NewClient(\u0026goredislib.Options{\n\t\tAddr: \"localhost:6379\",\n\t})\n\tpool := goredis.NewPool(client) // or, pool := redigo.NewPool(...)\n\n\t// Create an instance of redisync to be used to obtain a mutual exclusion\n\t// lock.\n\trs := redsync.New(pool)\n\n\t// Obtain a new mutex by using the same name for all instances wanting the\n\t// same lock.\n\tmutexname := \"my-global-mutex\"\n\tmutex := rs.NewMutex(mutexname)\n\n\t// Obtain a lock for our given mutex. After this is successful, no one else\n\t// can obtain the same lock (the same mutex name) until we unlock it.\n\tif err := mutex.Lock(); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Do your work that requires the lock.\n\n\t// Release the lock so other processes or threads can obtain a lock.\n\tif ok, err := mutex.Unlock(); !ok || err != nil {\n\t\tpanic(\"unlock failed\")\n\t}\n}\n```\n\n## Contributing\n\nContributions are welcome.\n\n## License\n\nRedsync is available under the [BSD (3-Clause) License](https://opensource.org/licenses/BSD-3-Clause).\n\n## Disclaimer\n\nThis code implements an algorithm which is currently a proposal, it was not formally analyzed. Make sure to understand how it works before using it in production environments.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetdata%2Fredsync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetdata%2Fredsync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetdata%2Fredsync/lists"}