{"id":13412340,"url":"https://github.com/piaohao/godis","last_synced_at":"2026-01-20T09:05:20.585Z","repository":{"id":57486027,"uuid":"191868568","full_name":"piaohao/godis","owner":"piaohao","description":"redis client implement by golang, inspired by jedis.","archived":false,"fork":false,"pushed_at":"2020-05-12T07:08:10.000Z","size":314,"stargazers_count":113,"open_issues_count":0,"forks_count":18,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-13T21:21:24.047Z","etag":null,"topics":["go","golang","jedis","redis","redis-client"],"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/piaohao.png","metadata":{"files":{"readme":"README.cn.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":"2019-06-14T03:14:22.000Z","updated_at":"2025-05-21T02:38:43.000Z","dependencies_parsed_at":"2022-09-18T18:04:18.728Z","dependency_job_id":null,"html_url":"https://github.com/piaohao/godis","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/piaohao/godis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piaohao%2Fgodis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piaohao%2Fgodis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piaohao%2Fgodis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piaohao%2Fgodis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piaohao","download_url":"https://codeload.github.com/piaohao/godis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piaohao%2Fgodis/sbom","scorecard":{"id":732908,"data":{"date":"2025-08-11","repo":{"name":"github.com/piaohao/godis","commit":"72d439c918f28d4f47bb8e00997f37fd76e65e20"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Code-Review","score":0,"reason":"Found 0/26 approved changesets -- score normalized to 0","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":"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":10,"reason":"0 existing vulnerabilities detected","details":null,"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":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 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-22T14:56:58.346Z","repository_id":57486027,"created_at":"2025-08-22T14:56:58.346Z","updated_at":"2025-08-22T14:56:58.346Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28599858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T08:51:33.170Z","status":"ssl_error","status_checked_at":"2026-01-20T08:51:10.855Z","response_time":117,"last_error":"SSL_read: 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":["go","golang","jedis","redis","redis-client"],"created_at":"2024-07-30T20:01:23.607Z","updated_at":"2026-01-20T09:05:20.564Z","avatar_url":"https://github.com/piaohao.png","language":"Go","funding_links":[],"categories":["Database Drivers","数据库驱动程序","Generators","数据库驱动","NoSQL Databases","Data Integration Frameworks"],"sub_categories":["NoSQL Database Drivers","Advanced Console UIs","NoSQL数据库驱动程序","SQL 查询语句构建库"],"readme":"# godis\n[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/piaohao/godis)\n[![Build Status](https://travis-ci.com/piaohao/godis.svg?branch=dev.master)](https://travis-ci.com/piaohao/godis) \n[![Go Report](https://goreportcard.com/badge/github.com/piaohao/godis?123)](https://goreportcard.com/report/github.com/piaohao/godis) \n[![codecov](https://codecov.io/gh/piaohao/godis/branch/master/graph/badge.svg)](https://codecov.io/gh/piaohao/godis)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/piaohao/godis)\n\ngodis是一个golang实现的redis客户端,参考jedis实现.  \ngodis实现了几乎所有的redis命令,包括单机命令,集群命令,管道命令和事物命令等.  \n如果你用过jedis,你就能非常容易地上手godis,因为godis的方法命名几乎全部来自jedis.  \n值得一提的是,godis实现了单机和集群模式下的分布式锁,godis的锁比redisson快很多,在i7,8核32g的电脑测试,10万次for循环,8个线程,业务逻辑是简单的count++,redisson需要18-20秒,而godis只需要7秒左右.  \ngodis已经完成了大多数命令的测试用例,比较稳定.  \n非常高兴你能提出任何建议,我会积极地迭代这个项目.  \n\n* [github地址: https://github.com/piaohao/godis](https://github.com/piaohao/godis)\n* [gitee地址: https://gitee.com/piaohao/godis](https://gitee.com/piaohao/godis) \n\n# 特色\n* cluster集群\n* pipeline管道\n* transaction事物\n* distributed lock分布式锁\n* 其他功能在持续开发中\n\n# 安装\n```\ngo get -u github.com/piaohao/godis\n```\n或者使用 `go.mod`:\n```\nrequire github.com/piaohao/godis latest\n```\n# 文档\n\n* [ApiDoc](https://godoc.org/github.com/piaohao/godis)\n\n# 快速开始\n1. 基本例子\n\n    ```go\n    package main\n    \n    import (\n        \"github.com/piaohao/godis\"\n    )\n    \n    func main() {\n        redis := godis.NewRedis(\u0026godis.Option{\n            Host: \"localhost\",\n            Port: 6379,\n            Db:   0,\n        })\n        defer redis.Close()\n        redis.Set(\"godis\", \"1\")\n        arr, _ := redis.Get(\"godis\")\n        println(arr)\n    }\n    ```\n1. 使用连接池\n    ```go\n    package main\n    \n    import (\n        \"github.com/piaohao/godis\"\n    )\n    \n    func main() {\n        option:=\u0026godis.Option{\n            Host: \"localhost\",\n            Port: 6379,\n            Db:   0,\n        }\n        pool := godis.NewPool(\u0026godis.PoolConfig{}, option)\n        redis, _ := pool.GetResource()\n        defer redis.Close()\n        redis.Set(\"godis\", \"1\")\n        arr, _ := redis.Get(\"godis\")\n        println(arr)\n    }\n    ```\n1. 发布订阅\n    ```go\n    package main\n    \n    import (\n        \"github.com/piaohao/godis\"\n        \"time\"\n    )\n    \n    func main() {\n        option:=\u0026godis.Option{\n            Host: \"localhost\",\n            Port: 6379,\n            Db:   0,\n        }\n        pool := godis.NewPool(\u0026godis.PoolConfig{}, option)\n        go func() {\n            redis, _ := pool.GetResource()\n            defer redis.Close()\n            pubsub := \u0026godis.RedisPubSub{\n                OnMessage: func(channel, message string) {\n                    println(channel, message)\n                },\n                OnSubscribe: func(channel string, subscribedChannels int) {\n                    println(channel, subscribedChannels)\n                },\n                OnPong: func(channel string) {\n                    println(\"recieve pong\")\n                },\n            }\n            redis.Subscribe(pubsub, \"godis\")\n        }()\n        time.Sleep(1 * time.Second)\n        {\n            redis, _ := pool.GetResource()\n            defer redis.Close()\n            redis.Publish(\"godis\", \"godis pubsub\")\n            redis.Close()\n        }\n        time.Sleep(1 * time.Second)\n    }\n    ```\n1. cluster集群\n    ```go\n    package main\n    \n    import (\n        \"github.com/piaohao/godis\"\n        \"time\"\n    )\n    \n    func main() {\n        cluster := godis.NewRedisCluster(\u0026godis.ClusterOption{\n            Nodes:             []string{\"localhost:7000\", \"localhost:7001\", \"localhost:7002\", \"localhost:7003\", \"localhost:7004\", \"localhost:7005\"},\n            ConnectionTimeout: 0,\n            SoTimeout:         0,\n            MaxAttempts:       0,\n            Password:          \"\",\n            PoolConfig:        \u0026godis.PoolConfig{},\n        })\n        cluster.Set(\"cluster\", \"godis cluster\")\n        reply, _ := cluster.Get(\"cluster\")\n        println(reply)\n    }\n    ```\n1. pipeline管道\n    ```go\n    package main\n    \n    import (\n        \"github.com/piaohao/godis\"\n        \"time\"\n    )\n    \n    func main() {\n        option:=\u0026godis.Option{\n            Host: \"localhost\",\n            Port: 6379,\n            Db:   0,\n        }\n        pool := godis.NewPool(\u0026godis.PoolConfig{}, option)\n        redis, _ := pool.GetResource()\n        defer redis.Close()\n        p := redis.Pipelined()\n        infoResp, _ := p.Info()\n        timeResp, _ := p.Time()\n        p.Sync()\n        timeList, _ := timeResp.Get()\n        println(timeList)\n        info, _ := infoResp.Get()\n        println(info)\n    }\n    ```\n1. transaction事物\n    ```go\n    package main\n    \n    import (\n        \"github.com/piaohao/godis\"\n        \"time\"\n    )\n    \n    func main() {\n        option:=\u0026godis.Option{\n            Host: \"localhost\",\n            Port: 6379,\n            Db:   0,\n        }\n        pool := godis.NewPool(nil, option)\n        redis, _ := pool.GetResource()\n        defer redis.Close()\n        p, _ := redis.Multi()\n        infoResp, _ := p.Info()\n        timeResp, _ := p.Time()\n        p.Exec()\n        timeList, _ := timeResp.Get()\n        println(timeList)\n        info, _ := infoResp.Get()\n        println(info)\n    }\n    ``` \n1. distribute lock分布式锁\n    * single redis   \n         ```go\n            package main\n            \n            import (\n                \"github.com/piaohao/godis\"\n                \"time\"\n            )\n            \n            func main() {\n                locker := godis.NewLocker(\u0026godis.Option{\n                      Host: \"localhost\",\n                      Port: 6379,\n                      Db:   0,\n                  }, \u0026godis.LockOption{\n                      Timeout: 5*time.Second,\n                  })\n                lock, err := locker.TryLock(\"lock\")\n                if err == nil \u0026\u0026 lock!=nil {\n                    //do something\n                    locker.UnLock(lock)\n                }\n                \n            }\n        ``` \n    * redis cluster   \n         ```go\n            package main\n            \n            import (\n                \"github.com/piaohao/godis\"\n                \"time\"\n            )\n            \n            func main() {\n                locker := godis.NewClusterLocker(\u0026godis.ClusterOption{\n                \tNodes:             []string{\"localhost:7000\", \"localhost:7001\", \"localhost:7002\", \"localhost:7003\", \"localhost:7004\", \"localhost:7005\"},\n                    ConnectionTimeout: 0,\n                    SoTimeout:         0,\n                    MaxAttempts:       0,\n                    Password:          \"\",\n                    PoolConfig:        \u0026godis.PoolConfig{},\n                },\u0026godis.LockOption{\n                    Timeout: 5*time.Second,\n                })\n                lock, err := locker.TryLock(\"lock\")\n                if err == nil \u0026\u0026 lock!=nil {\n                    //do something\n                    locker.UnLock(lock)\n                }\n            }\n        ```   \n# 证书\n\n`godis` 使用的是 [MIT License](LICENSE), 永远100%免费和开源.      \n\n# 鸣谢\n* [jedis,java非常出名的redis客户端](https://github.com/xetorthio/jedis)\n* [gf,功能非常强大的go web框架](https://github.com/gogf/gf)\n* [go-commons-pool,参照apache common-pool实现的go连接池](https://github.com/jolestar/go-commons-pool)\n\n# 联系\n\npiao.hao@qq.com\n     ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiaohao%2Fgodis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiaohao%2Fgodis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiaohao%2Fgodis/lists"}