{"id":28185976,"url":"https://github.com/glidea/gcache","last_synced_at":"2025-05-16T06:13:19.510Z","repository":{"id":256880521,"uuid":"413852839","full_name":"glidea/gcache","owner":"glidea","description":"mini distributed cache","archived":false,"fork":false,"pushed_at":"2021-10-06T01:58:55.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-13T15:57:52.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glidea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-10-05T14:30:01.000Z","updated_at":"2024-09-13T02:50:55.000Z","dependencies_parsed_at":"2024-09-13T15:57:58.950Z","dependency_job_id":"884d202f-f8aa-4e6e-8635-db966304ee68","html_url":"https://github.com/glidea/gcache","commit_stats":null,"previous_names":["glidea/gcache"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fgcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fgcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fgcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glidea%2Fgcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glidea","download_url":"https://codeload.github.com/glidea/gcache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478023,"owners_count":22077679,"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":"2025-05-16T06:13:18.832Z","updated_at":"2025-05-16T06:13:19.500Z","avatar_url":"https://github.com/glidea.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"一个分布式缓存框架（仿照 groupcache 实现，当然现在看起来已经没什么关系了）\n### 主要特点\n* 代码小巧，适合作为学习向的项目\n* 易拓展。注册中心、缓存淘汰策略、RPC 协议、数据分片策略均可轻易替换实现\n### 快速开始\n```go\nvar (\n    dbHeight = map[string]string{\n        \"laowang\":  \"173\", \n        \"xiaoming\": \"166\",\n    }\n    dbScore = map[string]string{\n        \"laowang\":  \"96\", \n        \"xiaoming\": \"97\",\n    }\n)\n\nfunc main() {\n    c := gcache.New()\n    c.Group(\"height\", 1\u003c\u003c10, gcache.EvictionLru, time.Minute, gcache.ShardingConsistenthash,\n        gcache.DBGetterFunc(func(key string) ([]byte, error) {\n            return []byte(dbHeight[key]), nil\n        }))\n    c.Group(\"score\", 1\u003c\u003c10, gcache.EvictionLru, time.Minute, gcache.ShardingConsistenthash, \n        gcache.DBGetterFunc(func(key string) ([]byte, error) {\n            return []byte(dbScore[key]), nil\n        }))\n    c.Registry(gcache.RegistryZK, \"xxxxxxxxx\")\n    c.Protocol(gcache.ProtocolHTTP)\n    err := c.Start(\":6060\")\n    if err != nil {\n        log.Fatal(\"server start fail: \" + err.Error())\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglidea%2Fgcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglidea%2Fgcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglidea%2Fgcache/lists"}