{"id":42621702,"url":"https://github.com/alexmerren/httpcache","last_synced_at":"2026-01-29T04:24:31.677Z","repository":{"id":191221364,"uuid":"684103657","full_name":"alexmerren/httpcache","owner":"alexmerren","description":"A HTTP RoundTripper with a local SQLite cache","archived":false,"fork":false,"pushed_at":"2025-10-22T18:57:14.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-15T05:15:03.048Z","etag":null,"topics":["caching","go","http","roundtripper"],"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/alexmerren.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-28T13:13:53.000Z","updated_at":"2025-03-09T18:48:54.000Z","dependencies_parsed_at":"2024-03-23T21:34:10.305Z","dependency_job_id":"f7dbd62e-fbe9-4a4c-ab11-0ef7f4c00f91","html_url":"https://github.com/alexmerren/httpcache","commit_stats":null,"previous_names":["alexmerren/httpcache","alexmerren/http-cache"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/alexmerren/httpcache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexmerren%2Fhttpcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexmerren%2Fhttpcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexmerren%2Fhttpcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexmerren%2Fhttpcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexmerren","download_url":"https://codeload.github.com/alexmerren/httpcache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexmerren%2Fhttpcache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28862149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T22:56:21.783Z","status":"online","status_checked_at":"2026-01-29T02:00:06.714Z","response_time":59,"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":["caching","go","http","roundtripper"],"created_at":"2026-01-29T04:24:30.977Z","updated_at":"2026-01-29T04:24:31.667Z","avatar_url":"https://github.com/alexmerren.png","language":"Go","readme":"# httpcache\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/alexmerren/httpcache)](https://goreportcard.com/report/github.com/alexmerren/httpcache)\n![Go Version](https://img.shields.io/badge/go%20version-%3E=1.21-61CFDD.svg?style=flat-square)\n[![Go Reference](https://pkg.go.dev/badge/github.com/alexmerren/httpcache.svg)](https://pkg.go.dev/github.com/alexmerren/httpcache)\n\nhttpcache is a local cache for HTTP requests and responses, wrapping `http.RoundTripper` from Go standard library.\n\n## Features\n\nhttpcache has a few useful features:\n\n- Store and retrieve HTTP responses for any type of request;\n- Expire responses after a customisable time duration;\n- Decide when to store responses based on status code and request method.\n\nIf you want to request a feature then please open a [GitHub Issue](https://www.github.com/alexmerren/httpcache/issues) today!\n\n## Quick Start\n\nThis module can be installed using the command line:\n\n```bash\ngo get -u github.com/alexmerren/httpcache\n```\n\nHere's an example of using the `httpcache` module to cache responses:\n\n```go\nfunc main() {\n\t// Create a new SQLite database to store HTTP responses.\n\tcache, _ := httpcache.NewSqliteCache(\"database.sqlite\")\n\n\t// Create a config with a behaviour of:\n\t// \t- Storing responses with status code 200;\n\t// \t- Storing responses from HTTP requests using method \"GET\";\n\t// \t- Expiring responses after 7 days...\n\tconfig := httpcache.NewConfigBuilder().\n\t\tWithAllowedStatusCodes([]int{http.StatusOK}).\n\t\tWithAllowedMethods([]string{http.MethodGet}).\n\t\tWithExpiryTime(time.Duration(60*24*7) * time.Minute).\n\t\tBuild()\n\n\t// ... or use the default config.\n\tconfig = httpcache.DefaultConfig\n\n\t// Create a transport with the SQLite cache and config.\n\tcachedTransport, _ := httpcache.NewTransport(config, cache)\n\n\t// Create a HTTP client with the cached roundtripper.\n\thttpClient := http.Client{\n\t\tTransport: cachedTransport,\n\t}\n\n\t// Do first request to populate local database.\n\thttpClient.Get(\"https://www.google.com\")\n\n\t// Subsequent requests read from database with no outgoing HTTP request.\n\tfor _ = range 10 {\n\t\tresponse, _ := httpClient.Get(\"https://www.google.com\")\n\t\tdefer response.Body.Close()\n\t\tresponseBody, _ := io.ReadAll(response.Body)\n\n\t\tfmt.Println(string(responseBody))\n\t}\n}\n```\n\n## ❓ Questions and Support\n\nAny questions can be submitted via [GitHub Issues](https://www.github.com/alexmerren/httpcache/issues). Feel free to start contributing or asking any questions required!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexmerren%2Fhttpcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexmerren%2Fhttpcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexmerren%2Fhttpcache/lists"}