{"id":19180789,"url":"https://github.com/xpzouying/groupcache-practice","last_synced_at":"2025-08-23T05:05:28.221Z","repository":{"id":73177288,"uuid":"107109052","full_name":"xpzouying/groupcache-practice","owner":"xpzouying","description":"The practice for groupcache","archived":false,"fork":false,"pushed_at":"2020-02-24T06:03:11.000Z","size":28,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-23T05:03:30.520Z","etag":null,"topics":["golang","groupcache","practice"],"latest_commit_sha":null,"homepage":null,"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/xpzouying.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,"publiccode":null,"codemeta":null}},"created_at":"2017-10-16T09:50:12.000Z","updated_at":"2020-09-21T10:11:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"d69ef2d7-d8a4-4ce3-8930-0b1bef8e047e","html_url":"https://github.com/xpzouying/groupcache-practice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xpzouying/groupcache-practice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgroupcache-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgroupcache-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgroupcache-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgroupcache-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xpzouying","download_url":"https://codeload.github.com/xpzouying/groupcache-practice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpzouying%2Fgroupcache-practice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745472,"owners_count":24813499,"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-08-23T02:00:09.327Z","response_time":69,"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":["golang","groupcache","practice"],"created_at":"2024-11-09T10:51:08.871Z","updated_at":"2025-08-23T05:05:28.172Z","avatar_url":"https://github.com/xpzouying.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# groupcache-practice\nThe practice for groupcache\n\nCreate the project use [groupcache](https://github.com/golang/groupcache)\n\nEnvironments:\n\n- based on custom slow database for test\n- multiple cache nodes for HA\n\n\n![](./images/golang-groupcache.jpg)\n\n\n**groupcache version**\n\n- Date: 2020-02-24\n- Commit ID: 8c9f03a8e57eb486e42badaed3fb287da51807ba\n\n\n**Run step:**\n\n1. run database server\n\n```bash\ncd database \u0026\u0026 go run main.go\n```\n\n2. insert data into database\n\n```bash\n# insert one entry:\n# key: name, value: zouying\ncurl -H \"Content-Type: application/json\" -X POST -d '{\"key\": \"name\", \"value\": \"zouying\"}' http://localhost:9000/set\n\n# check insert\ncurl -H \"Content-Type: application/json\" -X POST -d '{\"key\": \"name\"}' http://localhost:9000/get\n```\n\n3. run frontend (include cache). Two node in cache cluster.\n\n```bash\ncd frontend\n\n# run the first node\ngo run ./main.go -addr=\":8001\" -port \":18001\"\n\n# run the second node\ngo run ./main.go -addr=\":8002\" -port \":18002\"\n```\n\n4. get the value, the first try will get from database\n```bash\n# try the first node api\ncurl -H \"Content-Type: application/json\" -X POST -d '{\"key\": \"name\"}' http://localhost:18001/get\n\n# try the second node api\ncurl -H \"Content-Type: application/json\" -X POST -d '{\"key\": \"name\"}' http://localhost:18002/get\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpzouying%2Fgroupcache-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxpzouying%2Fgroupcache-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpzouying%2Fgroupcache-practice/lists"}