{"id":13472176,"url":"https://github.com/hoisie/redis","last_synced_at":"2025-05-16T18:10:04.331Z","repository":{"id":786154,"uuid":"481767","full_name":"hoisie/redis","owner":"hoisie","description":"A simple, powerful Redis client for Go","archived":false,"fork":false,"pushed_at":"2016-07-30T15:45:59.000Z","size":800,"stargazers_count":589,"open_issues_count":15,"forks_count":228,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-12T17:46:24.627Z","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/hoisie.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":"2010-01-21T05:58:22.000Z","updated_at":"2025-03-06T04:45:39.000Z","dependencies_parsed_at":"2022-07-05T14:32:09.554Z","dependency_job_id":null,"html_url":"https://github.com/hoisie/redis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoisie%2Fredis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoisie%2Fredis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoisie%2Fredis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoisie%2Fredis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoisie","download_url":"https://codeload.github.com/hoisie/redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582907,"owners_count":22095518,"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","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":"2024-07-31T16:00:52.634Z","updated_at":"2025-05-16T18:10:04.305Z","avatar_url":"https://github.com/hoisie.png","language":"Go","funding_links":[],"categories":["Database Drivers","Go","\u003cspan id=\"数据库驱动-database-drivers\"\u003e数据库驱动 Database Drivers\u003c/span\u003e","數據庫驅動","数据库驱动"],"sub_categories":["Advanced Console UIs","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","高級控制台界面","高级控制台界面","Middlewares"],"readme":"## redis.go\n\nredis.go is a client for the [redis](http://github.com/antirez/redis) key-value store. \n\nSome features include:\n\n* Designed for Redis 2.6.x. \n* Support for all redis types - strings, lists, sets, sorted sets, and hashes\n* Very simple usage\n* Connection pooling ( with configurable size )\n* Support for concurrent access\n* Manages connections to the redis server, including dropped and timed out connections\n* Marshaling/Unmarshaling go types to hashes\n\nThis library is stable and is used in production environments. However, some commands have not been tested as thoroughly as others. If you find any bugs please file an issue!\n\n# Installation\n\nJust run `go get github.com/hoisie/redis`\n\n## Examples\n\nMost of the examples connect to a redis database running in the default port -- 6379. \n\n\n### Hello World example\n\n```go\npackage main\n\nimport \"github.com/hoisie/redis\"\n\nfunc main() {\n    var client redis.Client\n    var key = \"hello\"\n    client.Set(key, []byte(\"world\"))\n    val, _ := client.Get(\"hello\")\n    println(key, string(val))\n}\n```\n\n### Strings \n```go\nvar client redis.Client\nclient.Set(\"a\", []byte(\"hello\"))\nval, _ := client.Get(\"a\")\nprintln(string(val))\nclient.Del(\"a\")\n```\n### Lists\n```go\nvar client redis.Client\nvals := []string{\"a\", \"b\", \"c\", \"d\", \"e\"}\nfor _, v := range vals {\n    client.Rpush(\"l\", []byte(v))\n}\ndbvals,_ := client.Lrange(\"l\", 0, 4)\nfor i, v := range dbvals {\n    println(i,\":\",string(v))\n}\nclient.Del(\"l\")\n```\n### Publish/Subscribe\n```go\nsub := make(chan string, 1)\nsub \u003c- \"foo\"\nmessages := make(chan Message, 0)\ngo client.Subscribe(sub, nil, nil, nil, messages)\n\ntime.Sleep(10 * 1000 * 1000)\nclient.Publish(\"foo\", []byte(\"bar\"))\n\nmsg := \u003c-messages\nprintln(\"received from:\", msg.Channel, \" message:\", string(msg.Message))\n\nclose(sub)\nclose(messages)\n```\n\nMore examples coming soon. See `redis_test.go` for more usage examples.\n\n## Commands not supported yet\n\n* MULTI/EXEC/DISCARD/WATCH/UNWATCH\n* SORT\n* ZUNIONSTORE / ZINTERSTORE\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoisie%2Fredis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoisie%2Fredis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoisie%2Fredis/lists"}