{"id":13462482,"url":"https://github.com/ronnylt/redlock-php","last_synced_at":"2025-10-08T13:17:20.030Z","repository":{"id":17116240,"uuid":"19882299","full_name":"ronnylt/redlock-php","owner":"ronnylt","description":"Redis distributed locks in PHP","archived":false,"fork":false,"pushed_at":"2020-08-11T17:36:09.000Z","size":6,"stargazers_count":770,"open_issues_count":14,"forks_count":210,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-09-03T12:52:00.550Z","etag":null,"topics":["distributed","lock","php","redis"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ronnylt.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":"2014-05-17T08:36:05.000Z","updated_at":"2025-07-21T12:19:20.000Z","dependencies_parsed_at":"2022-07-26T01:49:39.964Z","dependency_job_id":null,"html_url":"https://github.com/ronnylt/redlock-php","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ronnylt/redlock-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronnylt%2Fredlock-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronnylt%2Fredlock-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronnylt%2Fredlock-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronnylt%2Fredlock-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ronnylt","download_url":"https://codeload.github.com/ronnylt/redlock-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronnylt%2Fredlock-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278949320,"owners_count":26074010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["distributed","lock","php","redis"],"created_at":"2024-07-31T12:00:49.261Z","updated_at":"2025-10-08T13:17:20.009Z","avatar_url":"https://github.com/ronnylt.png","language":"PHP","readme":"# RedLock – Redis distributed locks in PHP\n\nBased on [Redlock-rb](https://github.com/antirez/redlock-rb) by [Salvatore Sanfilippo](https://github.com/antirez)\n\nThis library implements the Redis-based distributed lock manager algorithm [described in this blog post](http://antirez.com/news/77).\n\nTo create a lock manager:\n\n```php\n\n$servers = [\n    ['127.0.0.1', 6379, 0.01],\n    ['127.0.0.1', 6389, 0.01],\n    ['127.0.0.1', 6399, 0.01],\n];\n\n$redLock = new RedLock($servers);\n\n```\n\nTo acquire a lock:\n\n```php\n\n$lock = $redLock-\u003elock('my_resource_name', 1000);\n\n```\n\nWhere the resource name is an unique identifier of what you are trying to lock\nand 1000 is the number of milliseconds for the validity time.\n\nThe returned value is `false` if the lock was not acquired (you may try again),\notherwise an array representing the lock is returned, having three keys:\n\n```php\nArray\n(\n    [validity] =\u003e 9897.3020019531\n    [resource] =\u003e my_resource_name\n    [token] =\u003e 53771bfa1e775\n)\n```\n\n* validity, an integer representing the number of milliseconds the lock will be valid.\n* resource, the name of the locked resource as specified by the user.\n* token, a random token value which is used to safe reclaim the lock.\n\nTo release a lock:\n\n```php\n    $redLock-\u003eunlock($lock)\n```\n\nIt is possible to setup the number of retries (by default 3) and the retry\ndelay (by default 200 milliseconds) used to acquire the lock.\n\nThe retry delay is actually chosen at random between `$retryDelay / 2` milliseconds and\nthe specified `$retryDelay` value.\n\n**Disclaimer**: As stated in the original antirez's version, this code implements an algorithm\nwhich is currently a proposal, it was not formally analyzed. Make sure to understand how it works\nbefore using it in your production environments.\n","funding_links":[],"categories":["Uncategorized","PHP"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronnylt%2Fredlock-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fronnylt%2Fredlock-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronnylt%2Fredlock-php/lists"}