{"id":37094951,"url":"https://github.com/vokinneberg/http-cache","last_synced_at":"2026-01-14T11:41:54.012Z","repository":{"id":49991551,"uuid":"252113851","full_name":"vokinneberg/http-cache","owner":"vokinneberg","description":"Caching proxy as middleware for Go.","archived":false,"fork":false,"pushed_at":"2022-04-11T01:24:35.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-12T04:59:50.908Z","etag":null,"topics":["cache","cache-middleware","go-http","gorilla-mux","http-server","middleware","negroni"],"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/vokinneberg.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}},"created_at":"2020-04-01T08:17:21.000Z","updated_at":"2021-06-07T13:30:59.000Z","dependencies_parsed_at":"2022-09-26T19:53:05.322Z","dependency_job_id":null,"html_url":"https://github.com/vokinneberg/http-cache","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vokinneberg/http-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vokinneberg%2Fhttp-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vokinneberg%2Fhttp-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vokinneberg%2Fhttp-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vokinneberg%2Fhttp-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vokinneberg","download_url":"https://codeload.github.com/vokinneberg/http-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vokinneberg%2Fhttp-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["cache","cache-middleware","go-http","gorilla-mux","http-server","middleware","negroni"],"created_at":"2026-01-14T11:41:53.353Z","updated_at":"2026-01-14T11:41:54.007Z","avatar_url":"https://github.com/vokinneberg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# http-cache\n\nCaching proxy as middleware for Go.\n\n## Why?\n\nFirst, this was part of the job test assessment. But I think it shouldn't go to the trash bin and might be useful for someone. So, generally speaking - Just for fun 😊\n\n## Getting Started\n\n### Installation\n\n`go get -u github.com/vokinneberg/http-cache`\n\n### Usage\n\n#### Generic Go middleware\n\n```Go\nfunc main() {\n    mux := http.NewServeMux()\n    mux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n        w.Header().Set(\"Content-Type\", \"application/json\")\n        w.Write([]byte(\"{\\\"hello\\\": \\\"world\\\"}\"))\n    })\n\n    handler := httpcache.NewDefault().Handler(mux)\n    http.ListenAndServe(\":8080\", handler)\n}\n```\n\n#### Gorilla mux\n\n```Go\nfunc main() {\n    mux := mux.NewRouter()\n    mux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n        w.Header().Set(\"Content-Type\", \"application/json\")\n        w.Write([]byte(\"{\\\"hello\\\": \\\"world\\\"}\"))\n    })\n\n    handler := httpcache.NewDefault().Handler(mux)\n    http.ListenAndServe(\":8080\", handler)\n}\n```\n\n#### Negroni middleware\n\n```Go\nfunc main() {\n    mux := http.NewServeMux()\n\n    mux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n        w.Header().Set(\"Content-Type\", \"application/json\")\n        w.Write([]byte(\"{\\\"hello\\\": \\\"world\\\"}\"))\n    })\n\n    n := negroni.Classic()\n\n    n.Use(httpcache.NewDefault())\n    n.UseHandler(mux)\n    n.Run(\":8080\")\n}\n```\n\n## Roadmap\n\n* Add Unit tests.\n* Add benchmarks - I really interested in how efficient this implementation is?\n* Add Debug option.\n* Make middleware [RFC7234](https://tools.ietf.org/html/rfc7234) complaint.\n  * Add support for [Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) header.\n* Add more data store adapters such as: [Redis](https://redis.io/), [memcached](https://www.memcached.org/), [DynamoDB](https://aws.amazon.com/dynamodb/), etc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvokinneberg%2Fhttp-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvokinneberg%2Fhttp-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvokinneberg%2Fhttp-cache/lists"}