{"id":34164339,"url":"https://github.com/praharshjain/go-cache","last_synced_at":"2026-03-11T02:03:22.756Z","repository":{"id":62866942,"uuid":"556413893","full_name":"praharshjain/go-cache","owner":"praharshjain","description":"A caching library for Go","archived":false,"fork":false,"pushed_at":"2023-05-11T05:29:31.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-18T05:34:11.669Z","etag":null,"topics":["cache","caching","caching-library","go","go-lib","go-library","go-package","golang","golang-lib","golang-library","golang-package"],"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/praharshjain.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":"2022-10-23T19:51:02.000Z","updated_at":"2022-10-23T20:09:37.000Z","dependencies_parsed_at":"2024-06-20T10:21:02.540Z","dependency_job_id":"b41284ab-c63d-4e44-8f51-d12b904f13da","html_url":"https://github.com/praharshjain/go-cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/praharshjain/go-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fgo-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fgo-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fgo-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fgo-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/praharshjain","download_url":"https://codeload.github.com/praharshjain/go-cache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fgo-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30367810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"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":["cache","caching","caching-library","go","go-lib","go-library","go-package","golang","golang-lib","golang-library","golang-package"],"created_at":"2025-12-15T09:47:51.300Z","updated_at":"2026-03-11T02:03:22.741Z","avatar_url":"https://github.com/praharshjain.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-cache\n========== \nA light-weight caching library for Go. It can cache the results of a function with given TTL.\n\nKnown caveats\n----------------\n1. Return value of the function to be cached should be exactly a result (of any type) and an error\n2. Function to be cached should not be declared using `var fn = func` syntax but `func fn` instead. (This is because the library uses reflection to fetch the function name)\n3. Data in the `InApp` store just expires, but is never deleted even after TTL. So it should be used responsibly.\n\nUsage\n----------------\n1. Init config (only to be done once, generally at the start of your service)\n```go\n//call Init with config map (refer config.json for sample)\nInit(cfg)\n````\n2. Instantiate a cache store (store is meant to be reused across calls to Cache)\n```go\n//store is to be instantiated only once and not on every call to Cache()\nstore := NewInApp()\n```\n3. Use the store in Cache function as\n```go\nres, err := Cache(ctx, key, store, fn, args...)\n```\n4. Then you need to type case the result into the expected return type of the function\n```go\ns, _ := res.(string)\n```\n\nUse any of the available stores like -\n```\nInApp,\nInRedis,\nor implement your own custom store.\n```\nsee `examples_test.go` for more","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraharshjain%2Fgo-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraharshjain%2Fgo-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraharshjain%2Fgo-cache/lists"}