{"id":15323663,"url":"https://github.com/joeig/gin-cachecontrol","last_synced_at":"2025-04-15T02:50:20.826Z","repository":{"id":42365715,"uuid":"445910570","full_name":"joeig/gin-cachecontrol","owner":"joeig","description":"Cache-Control middleware for Gin","archived":false,"fork":false,"pushed_at":"2025-04-14T06:35:47.000Z","size":73,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T07:37:21.813Z","etag":null,"topics":["cache-control","gin","go","http"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/go.eigsys.de/gin-cachecontrol/v2","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/joeig.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-01-08T19:31:26.000Z","updated_at":"2025-04-14T06:35:50.000Z","dependencies_parsed_at":"2023-11-30T15:29:38.280Z","dependency_job_id":"3921427a-4c6b-4b4c-988e-cd75dc600482","html_url":"https://github.com/joeig/gin-cachecontrol","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgin-cachecontrol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgin-cachecontrol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgin-cachecontrol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeig%2Fgin-cachecontrol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeig","download_url":"https://codeload.github.com/joeig/gin-cachecontrol/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997087,"owners_count":21195797,"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":["cache-control","gin","go","http"],"created_at":"2024-10-01T09:20:54.020Z","updated_at":"2025-04-15T02:50:20.809Z","avatar_url":"https://github.com/joeig.png","language":"Go","readme":"# Cache-Control middleware for Gin\n\nThis Gin middleware generates cache-control headers.\n\n[![Test coverage](https://img.shields.io/badge/coverage-100%25-success)](https://github.com/joeig/gin-cachecontrol/tree/master/.github/testcoverage.yml)\n[![Go Report Card](https://goreportcard.com/badge/go.eigsys.de/gin-cachecontrol/v2)](https://goreportcard.com/report/go.eigsys.de/gin-cachecontrol/v2)\n[![PkgGoDev](https://pkg.go.dev/badge/go.eigsys.de/gin-cachecontrol/v2)](https://pkg.go.dev/go.eigsys.de/gin-cachecontrol/v2)\n\n## Setup\n\n```shell\ngo get -u go.eigsys.de/gin-cachecontrol/v2\n```\n\n```go\nimport \"go.eigsys.de/gin-cachecontrol/v2\"\n```\n\n## Usage\n\n### With a preset\n\n```go\n// Apply globally:\nr.Use(cachecontrol.New(cachecontrol.NoCachePreset))\n\n// Apply to specific routes:\ncacheForever := cachecontrol.New(cachecontrol.CacheAssetsForeverPreset)\nr.GET(\"/favicon.ico\", cacheForever, faviconHandler)\n```\n\nSupported presets ([documentation](https://pkg.go.dev/go.eigsys.de/gin-cachecontrol/v2#pkg-variables)):\n\n* `cachecontrol.NoCachePreset`\n* `cachecontrol.CacheAssetsForeverPreset` (you may only want this for carefully selected routes)\n\n### With a custom configuration\n\n```go\nr.Use(\n    cachecontrol.New(\n        cachecontrol.Config{\n            MustRevalidate:       true,\n            NoCache:              false,\n            NoStore:              false,\n            NoTransform:          false,\n            Public:               true,\n            Private:              false,\n            ProxyRevalidate:      true,\n            MaxAge:               cachecontrol.Duration(30 * time.Minute),\n            SMaxAge:              nil,\n            Immutable:            false,\n            StaleWhileRevalidate: cachecontrol.Duration(2 * time.Hour),\n            StaleIfError:         cachecontrol.Duration(2 * time.Hour),\n        }\n    )\n)\n```\n\n## Documentation\n\nSee [Go reference](https://pkg.go.dev/go.eigsys.de/gin-cachecontrol/v2).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeig%2Fgin-cachecontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeig%2Fgin-cachecontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeig%2Fgin-cachecontrol/lists"}