{"id":36530885,"url":"https://github.com/bitleak/go-redis-pool","last_synced_at":"2026-01-12T03:01:15.817Z","repository":{"id":40277335,"uuid":"241004809","full_name":"bitleak/go-redis-pool","owner":"bitleak","description":"Implements the golang redis sharding and read/write splits based on go-redis","archived":false,"fork":false,"pushed_at":"2025-04-16T08:57:44.000Z","size":2130,"stargazers_count":52,"open_issues_count":0,"forks_count":18,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-16T11:27:50.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/bitleak.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-02-17T02:37:49.000Z","updated_at":"2025-04-16T08:53:58.000Z","dependencies_parsed_at":"2025-04-16T09:54:03.704Z","dependency_job_id":"5c9991be-0652-44ad-998e-fe228dee451b","html_url":"https://github.com/bitleak/go-redis-pool","commit_stats":null,"previous_names":["meitu/go-redis-pool"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/bitleak/go-redis-pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitleak%2Fgo-redis-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitleak%2Fgo-redis-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitleak%2Fgo-redis-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitleak%2Fgo-redis-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitleak","download_url":"https://codeload.github.com/bitleak/go-redis-pool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitleak%2Fgo-redis-pool/sbom","scorecard":{"id":240344,"data":{"date":"2025-08-11","repo":{"name":"github.com/bitleak/go-redis-pool","commit":"757e4a4f794edba91bbacd399114624ab9a44c44"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":2,"reason":"Found 5/20 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/bitleak/go-redis-pool/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/bitleak/go-redis-pool/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/bitleak/go-redis-pool/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/bitleak/go-redis-pool/codeql.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":9,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:17","Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:16","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":2,"reason":"8 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3540","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T06:35:40.418Z","repository_id":40277335,"created_at":"2025-08-17T06:35:40.418Z","updated_at":"2025-08-17T06:35:40.418Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28332833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"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":[],"created_at":"2026-01-12T03:00:45.890Z","updated_at":"2026-01-12T03:01:15.805Z","avatar_url":"https://github.com/bitleak.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# go-redis-pool\n[![Build Status](https://travis-ci.org/bitleak/go-redis-pool.svg?branch=master)](https://travis-ci.org/bitleak/go-redis-pool) [![Go Report Card](https://goreportcard.com/badge/github.com/bitleak/go-redis-pool)](https://goreportcard.com/report/github.com/bitleak/go-redis-pool) [![Coverage Status](https://coveralls.io/repos/github/bitleak/go-redis-pool/badge.svg?branch=master)](https://coveralls.io/github/bitleak/go-redis-pool?branch=master) [![GitHub release](https://img.shields.io/github/tag/bitleak/go-redis-pool.svg?label=release)](https://github.com/bitleak/go-redis-pool/releases) [![GitHub release date](https://img.shields.io/github/release-date/bitleak/go-redis-pool.svg)](https://github.com/bitleak/go-redis-pool/releases) [![LICENSE](https://img.shields.io/github/license/bitleak/go-redis-pool.svg)](https://github.com/bitleak/go-redis-pool/blob/master/LICENSE) [![GoDoc](https://img.shields.io/badge/Godoc-reference-blue.svg)](https://godoc.org/github.com/bitleak/go-redis-pool)\n\n\ngo-redis-pool was designed to implement the read/write split in Redis master-slave mode, and easy way to sharding the data.\n\n## Installation\n\ngo-redis-pool requires a Go version with [Modules](https://github.com/golang/go/wiki/Modules) support and uses import versioning. So please make sure to initialize a Go module before installing go-redis-pool:\n\n```shell\ngo mod init github.com/my/repo\ngo get github.com/bitleak/go-redis-pool/v3\n```\n\n## Quick Start\n\nAPI documentation and examples are available via [godoc](https://godoc.org/github.com/bitleak/go-redis-pool/v3)\n\n### Setup The Master-Slave Pool\n\n```go\npool, err := pool.NewHA(\u0026pool.HAConfig{\n    Master: \"127.0.0.1:6379\",\n    Slaves: []string{\n        \"127.0.0.1:6380\",\n        \"127.0.0.1:6381\",\n    },\n    Password: \"\", // set master password\n    ReadonlyPassword: \"\", // use password if no set\n})\n\npool.Set(ctx, \"foo\", \"bar\", 0)\n```\n\nThe read-only commands would go throught slaves and write commands would into the master instance. We use the Round-Robin as default when determing which slave to serve the readonly request, and currently supports:\n\n* RoundRobin (default)\n* Random\n* Weight\n\nFor example, we change the distribution type to `Weight`:\n\n```go\npool, err := pool.NewHA(\u0026pool.HAConfig{\n    Master: \"127.0.0.1:6379\",\n    Slaves: []string{\n        \"127.0.0.1:6380\",  // default weight is 100 if missing\n        \"127.0.0.1:6381:200\", // weight is 200\n        \"127.0.0.1:6382:300\", // weigght is 300\n    },\n    PollType: pool.PollByWeight,\n})\n```\n\nThe first slave would serve 1/6 reqeusts, and second slave would serve 2/6, last one would serve 3/6. \n\n##### Auto Eject The Failure Host \n\n```go\npool, err := pool.NewHA(\u0026pool.HAConfig{\n    Master: \"127.0.0.1:6379\",\n    Slaves: []string{\n        \"127.0.0.1:6380\",  // default weight is 100 if missing\n        \"127.0.0.1:6381:200\", // weight is 200\n        \"127.0.0.1:6382:300\", // weigght is 300\n    },\n    AutoEjectHost: true,\n    ServerFailureLimit: 3,\n    ServerRetryTimeout: 5 * time.Second,\n    MinServerNum: 2,\n})\n```\n\nThe pool would evict the host if reached `ServerFailureLimit` times of failure and retry the host after `ServerRetryTimeout`. The\n`MinServerNum` was used to avoid evicting too many and would overrun other alive servers. \n\n#### Setup The Sharding Pool\n\n```go\npool, err := pool.NewShard(\u0026pool.ShardConfig{\n    Shards: []*HAConfig {\n        // shard 1\n        \u0026pool.HAConfig{\n            Master: \"127.0.0.1:6379\",\n            Slaves: []string{\n                \"127.0.0.1:6380\",\n                \"127.0.0.1:6381\",\n            },\n            DistributeType: pool.DistributeByModular,\n            HashFn: hashkit.Xxh3,\n        },\n        // shard 2\n        \u0026pool.HAConfig{\n            Master: \"127.0.0.1:6382\",\n            Slaves: []string{\n                \"127.0.0.1:6383\",\n            },\n            DistributeType: pool.DistributeByModular,\n            HashFn: hashkit.Xxh3,\n        },\n    },\n})\n\npool.Set(ctx, \"foo\", \"bar\", 0)\n```\n\nShard pool use the `CRC32` as default hash function when sharding the key, you can overwrite the `HashFn` in config if wants to use other sharding hash function. The distribution type supports `ketama` and `modular`, default is modular.\n\n## Test\n\n```shell\n$ make test\n```\n\n## See Also\n\n[https://github.com/go-redis/redis](https://github.com/go-redis/redis)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitleak%2Fgo-redis-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitleak%2Fgo-redis-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitleak%2Fgo-redis-pool/lists"}