{"id":34010537,"url":"https://github.com/chxj1992/hashring","last_synced_at":"2025-12-13T12:06:10.077Z","repository":{"id":17682027,"uuid":"82465711","full_name":"chxj1992/hashring","owner":"chxj1992","description":"Consistent hashing \"hashring\" implementation in php (using the same algorithm as libketama)","archived":false,"fork":false,"pushed_at":"2022-03-10T12:57:00.000Z","size":15,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-27T14:49:06.655Z","etag":null,"topics":["consistent-hashing","hashring","libketama","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chxj1992.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":"2017-02-19T14:41:50.000Z","updated_at":"2022-07-23T08:08:04.000Z","dependencies_parsed_at":"2022-07-26T02:02:08.864Z","dependency_job_id":null,"html_url":"https://github.com/chxj1992/hashring","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/chxj1992/hashring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxj1992%2Fhashring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxj1992%2Fhashring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxj1992%2Fhashring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxj1992%2Fhashring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chxj1992","download_url":"https://codeload.github.com/chxj1992/hashring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chxj1992%2Fhashring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27705413,"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-12-13T02:00:09.769Z","response_time":147,"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":["consistent-hashing","hashring","libketama","php"],"created_at":"2025-12-13T12:06:09.377Z","updated_at":"2025-12-13T12:06:10.073Z","avatar_url":"https://github.com/chxj1992.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"HashRing  [![Build Status](https://travis-ci.org/chxj1992/hashring.svg?branch=master)](https://travis-ci.org/chxj1992/hashring)\n============================\n\n\u003ca href=\"http://www.wtfpl.net/\"\u003e\u003cimg\n       src=\"http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-badge-4.png\"\n       width=\"80\" height=\"15\" alt=\"WTFPL\" /\u003e\u003c/a\u003e\n\nImplements consistent hashing that can be used when\nthe number of server nodes can increase or decrease (like in memcached).\nThe hashing ring is built using the same algorithm as libketama.\n\nInspired by a golang hashring library [serialx/hashring](https://github.com/serialx/hashring).\n\n\nUsing\n============================\n\nInstall ::\n\n```bash\ncomposer require chxj1992/hashring:~1.0\n```\n\nBasic example usage ::\n\n```php\n$memcacheServers = [\"192.168.0.246:11212\",\n                    \"192.168.0.247:11212\",\n                    \"192.168.0.249:11212\"];\n\n$hashRing = new \\Chxj1992\\HashRing\\HashRing($memcacheServers);\n$server = $ring-\u003egetNode(\"my_key\");\n```\n\nUsing weights example ::\n\n```php\n$weights = [\"192.168.0.246:11212\" =\u003e 1,\n            \"192.168.0.247:11212\" =\u003e 2,\n            \"192.168.0.249:11212\" =\u003e 1];\n\n$hashRing = new \\Chxj1992\\HashRing\\HashRing($weights);\n$server = $hashRing-\u003egetNode(\"my_key\");\n```\n\nAdding and removing nodes example ::\n\n```php\n$memcacheServers = [\"192.168.0.246:11212\",\n                    \"192.168.0.247:11212\",\n                    \"192.168.0.249:11212\"];\n\n$hashRing = new \\Chxj1992\\HashRing\\HashRing($memcacheServers);\n$hashRing = $hashRing-\u003eremoveNode(\"192.168.0.246:11212\");\n$hashRing = $hashRing-\u003eaddNode(\"192.168.0.250:11212\");\n$server = $hashRing-\u003egetNode(\"my_key\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchxj1992%2Fhashring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchxj1992%2Fhashring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchxj1992%2Fhashring/lists"}