{"id":25875960,"url":"https://github.com/andrewarrow/rock","last_synced_at":"2026-05-15T20:03:36.739Z","repository":{"id":222350974,"uuid":"756996132","full_name":"andrewarrow/rock","owner":"andrewarrow","description":"Redis Orchestration of Cluster Konnections ","archived":false,"fork":false,"pushed_at":"2024-03-02T13:47:12.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-26T09:12:14.087Z","etag":null,"topics":["elasticcache","golang","redis","redis-client","redis-cluster"],"latest_commit_sha":null,"homepage":"https://andrewarrow.dev/","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/andrewarrow.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-13T17:51:15.000Z","updated_at":"2024-02-13T18:17:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"c991aa31-ed51-4c85-8d4c-53cbd5991a63","html_url":"https://github.com/andrewarrow/rock","commit_stats":null,"previous_names":["andrewarrow/rock"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrewarrow/rock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Frock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Frock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Frock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Frock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewarrow","download_url":"https://codeload.github.com/andrewarrow/rock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewarrow%2Frock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33077961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["elasticcache","golang","redis","redis-client","redis-cluster"],"created_at":"2025-03-02T10:20:15.099Z","updated_at":"2026-05-15T20:03:36.699Z","avatar_url":"https://github.com/andrewarrow.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rock\nRedis Orchestration of Cluster Konnections \n\n```\nip := os.Getenv(\"REDIS_CLUSTER_IP\")\nport := os.Getenv(\"REDIS_CLUSTER_PORT\")\npoolSize := 2\nc := cluster.NewClient(poolSize, ip, port)\nc.ConnectAll()\nr := c.Info()\nfmt.Println(r)\nc.Set(\"test\", \"foo\")\nc.Get(\"test\")\n```\n\n# why not goredis\nI could not get goredis poolsize configs to work for me.\nThis is a very simple thread-safe redis cluster client.\n\n# how it works\n\n```\ntype Client struct {\n\tmu          sync.Mutex\n\trip         string\n\tconnections []*ClientConnection\n}\n```\n\nA client has a pool of N *ClientConnections.\n\n```\ntype ClientConnection struct {\n\thosts  map[string]net.Conn\n\ttarget string\n\tbuffer []byte\n}\n```\n\nEach ClientConnection has a map of redis node hostname+port and the\ncurrent \"target\" it just connected to after the last MOV.\n\nFor example:\n\n```\nhosts[\"127.0.0.1:30001\"] = conn1\nhosts[\"127.0.0.1:30002\"] = conn2\n```\n\nWhen it gets a MOV response with 127.0.0.1:30003 and 127.0.0.1:30003 is not\nin the map of hosts, it will connect and add it:\n\nhosts[\"127.0.0.1:30003\"] = conn3\n\n# calling commands\n\nYou can make calls like:\n\n```\nc.Set(\"test\", \"foo\")\nc.Get(\"test\")\nc.SAdd(\"foo\", \"bar\")\nc.SMembers(\"foo\")\nc.SRem(\"foo\", \"bar\")\n```\n\nAnd they are thread safe because;\n\n```\ncc := c.TakeFromPool()\ndefer c.PlaceBackInPool(cc)\n```\n\nBefore each command it gets its own ClientConnection from the pool\nand is the only one using that ClientConnection until it returns it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewarrow%2Frock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewarrow%2Frock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewarrow%2Frock/lists"}