{"id":13582532,"url":"https://github.com/sillygod/cdp-cache","last_synced_at":"2026-01-14T19:43:03.611Z","repository":{"id":38440009,"uuid":"261343524","full_name":"sillygod/cdp-cache","owner":"sillygod","description":"a caddy 2 proxy cache plugin","archived":false,"fork":false,"pushed_at":"2023-06-12T11:09:08.000Z","size":1605,"stargazers_count":121,"open_issues_count":9,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-06T14:36:37.819Z","etag":null,"topics":["cache","caddy-module","caddy2","golang","plugin","proxy"],"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/sillygod.png","metadata":{"files":{"readme":"readme.org","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}},"created_at":"2020-05-05T02:25:56.000Z","updated_at":"2025-03-16T21:22:27.000Z","dependencies_parsed_at":"2024-04-09T18:55:38.983Z","dependency_job_id":"f94dcf08-ccb3-456a-a099-371d53e33461","html_url":"https://github.com/sillygod/cdp-cache","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/sillygod/cdp-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillygod%2Fcdp-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillygod%2Fcdp-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillygod%2Fcdp-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillygod%2Fcdp-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sillygod","download_url":"https://codeload.github.com/sillygod/cdp-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillygod%2Fcdp-cache/sbom","scorecard":{"id":823812,"data":{"date":"2025-08-11","repo":{"name":"github.com/sillygod/cdp-cache","commit":"688faa87758631f0fb0b998c6e32e75386108269"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":2,"reason":"Found 6/30 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/main.yml:1","Warn: no topLevel permission defined: .github/workflows/pull_request.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/remove-old-artifacts.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.5.0 not signed: https://api.github.com/repos/sillygod/cdp-cache/releases/99054353","Warn: release artifact v0.4.6 not signed: https://api.github.com/repos/sillygod/cdp-cache/releases/47112326","Warn: release artifact v0.4.5 not signed: https://api.github.com/repos/sillygod/cdp-cache/releases/44210439","Warn: release artifact v0.4.3 not signed: https://api.github.com/repos/sillygod/cdp-cache/releases/35197982","Warn: release artifact v0.5.0 does not have provenance: https://api.github.com/repos/sillygod/cdp-cache/releases/99054353","Warn: release artifact v0.4.6 does not have provenance: https://api.github.com/repos/sillygod/cdp-cache/releases/47112326","Warn: release artifact v0.4.5 does not have provenance: https://api.github.com/repos/sillygod/cdp-cache/releases/44210439","Warn: release artifact v0.4.3 does not have provenance: https://api.github.com/repos/sillygod/cdp-cache/releases/35197982"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/main.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/main.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pull_request.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/pull_request.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pull_request.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/pull_request.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull_request.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/pull_request.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/remove-old-artifacts.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/sillygod/cdp-cache/remove-old-artifacts.yml/master?enable=pin","Warn: containerImage not pinned by hash: build/Dockerfile:1","Warn: containerImage not pinned by hash: build/Dockerfile:7: pin your Docker image by updating alpine:3.11.6 to alpine:3.11.6@sha256:9a839e63dad54c3a6d1834e29692c8492d93f90c59c978c1ed79109ea4fb9a54","Warn: containerImage not pinned by hash: build/ci.dockerfile:1: pin your Docker image by updating alpine:3.11.6 to alpine:3.11.6@sha256:9a839e63dad54c3a6d1834e29692c8492d93f90c59c978c1ed79109ea4fb9a54","Info:   0 out of  13 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   3 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"32 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3770","Warn: Project is vulnerable to: GO-2025-3372 / GHSA-6wxm-mpqj-6jpf","Warn: Project is vulnerable to: GO-2024-2606 / GHSA-7jwh-3vrq-q3m8 / GHSA-mrww-27vc-gghv","Warn: Project is vulnerable to: GO-2024-2605 / GHSA-m7wr-2xf7-cm9p","Warn: Project is vulnerable to: GO-2021-0051 / GHSA-j453-hm5x-c46w","Warn: Project is vulnerable to: GO-2022-1031 / GHSA-crxj-hrmp-4rwf","Warn: Project is vulnerable to: GHSA-77vh-xpmg-72qh","Warn: Project is vulnerable to: GO-2021-0087 / GHSA-fh74-hm69-rqjw","Warn: Project is vulnerable to: GO-2022-0396 / GHSA-g54h-m393-cpwq","Warn: Project is vulnerable to: GO-2022-0914 / GHSA-c3xm-pvg7-gh7r","Warn: Project is vulnerable to: GHSA-v95c-p5hm-xq8f","Warn: Project is vulnerable to: GO-2022-0452 / GHSA-f3fp-gc8g-vw66","Warn: Project is vulnerable to: GO-2023-1683 / GHSA-g2j6-57v7-gm8c","Warn: Project is vulnerable to: GO-2023-1682 / GHSA-m8cg-xc2p-r3fc","Warn: Project is vulnerable to: GO-2024-3110 / GHSA-jfvp-7x6p-h2pv","Warn: Project is vulnerable to: GO-2024-2459 / GHSA-ppxx-5m9h-6vxf","Warn: Project is vulnerable to: GO-2024-2682 / GHSA-c33x-xqrf-c478","Warn: Project is vulnerable to: GO-2024-3302 / GHSA-px8v-pp82-rcvr","Warn: Project is vulnerable to: GO-2025-3540","Warn: Project is vulnerable to: GO-2023-2113 / GHSA-rcjv-mgp8-qvmr","Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GO-2023-2153 / GHSA-m425-mq94-257g / GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw","Warn: Project is vulnerable to: GO-2024-2611 / GHSA-8r3f-844c-mc37","Warn: Project is vulnerable to: GO-2024-2631 / GHSA-c5q2-7r4c-mv6g"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T16:13:13.579Z","repository_id":38440009,"created_at":"2025-08-23T16:13:13.579Z","updated_at":"2025-08-23T16:13:13.579Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28432680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","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","caddy-module","caddy2","golang","plugin","proxy"],"created_at":"2024-08-01T15:02:48.248Z","updated_at":"2026-01-14T19:43:03.593Z","avatar_url":"https://github.com/sillygod.png","language":"Go","readme":"#+HTML: \u003ca href=\"https://github.com/sillygod/cdp-cache/actions?query=workflow%3ACI\"\u003e\u003cimg src=\"https://github.com/sillygod/cdp-cache/workflows/CI/badge.svg?branch=master\" /\u003e\u003c/a\u003e\n#+HTML: \u003c/div\u003e\n\n#+HTML: \u003ca href=\"https://www.codacy.com/manual/sillygod/cdp-cache?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=sillygod/cdp-cache\u0026amp;utm_campaign=Badge_Grade\"\u003e\u003cimg src=\"https://app.codacy.com/project/badge/Grade/43d801ba437a42419e479492eca72ee2\" /\u003e\u003c/a\u003e\n#+HTML: \u003c/div\u003e\n\n\n#+HTML: \u003ca href=\"https://goreportcard.com/report/github.com/sillygod/cdp-cache\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/sillygod/cdp-cache\" /\u003e\u003c/a\u003e\n#+HTML: \u003c/div\u003e\n\n#+HTML: \u003ca href=\"https://codeclimate.com/github/sillygod/cdp-cache/test_coverage\"\u003e\u003cimg src=\"https://api.codeclimate.com/v1/badges/a99b4ae948836cdedd12/test_coverage\" /\u003e\u003c/a\u003e\n\n\n* Caddy Http Cache\n\nThis is a http cache plugin for caddy 2.  The difference between this and cache-handler https://github.com/caddyserver/cache-handler is that this one is much easier to understand and configure.   But it does not support a =distrobuted ache=, and it needs to be compiled with golang 1.20 and caddy version v2.6.4\n\n\n  In fact, I am not so familiar with the part of cdn cache's mechanism so I reference the code from https://github.com/nicolasazrak/caddy-cache. which is the caddy v1's cache module. Then, I migrate the codebase to be consist with the caddy2 architecture and develop more features based on that.\n\n  Currently, this doesn't support =distributed cache= yet. It's still in plan.\n\n* Features\n\n** Multi storage backends support\n   Now the following backends are supported.\n\n   - file\n   - inmemory\n   - redis\n\n   In the latter part, I will show the example Caddyfile to serve different type of proxy cache server.\n\n** Conditional rule to cache the upstream response\n   - uri path matcher\n   - http header matcher\n\n** Set default cache's max age\n   A default age for matched responses that do not have an explicit expiration.\n** Purge cache\n   There are exposed endpoints to purge cache. I implement it with admin apis endpoints. The following will show you how to purge cache\n\n*** first you can list the current caches\n\n    Given that you specify the port 7777 to serve caddy admin, you can get the list of cache by the api below.\n\n    #+begin_src restclient\n      GET http://example.com:7777/caches\n    #+end_src\n\n*** purge the cache with http DELETE request\n    It supports the regular expression.\n\n    #+begin_src restclient\n      DELETE http://example.com:7777/caches/purge\n      Content-Type: application/json\n\n      {\n        \"method\": \"GET\",\n        \"host\": \"localhost\",\n        \"uri\": \".*\\\\.txt\"\n      }\n    #+end_src\n** Support cluster with consul\n\n   NOTE: still under development and only the =memory= backend supports.\n\n   I've provided a simple example to mimic a cluster environment.\n\n   #+begin_src sh\n     PROJECT_PATH=/app docker-compose --project-directory=./ -f example/distributed_cache/docker-compose.yaml up\n   #+end_src\n\n* How to build\n\n  In development, go to the cmd folder and type the following commands.\n\n  #+begin_src sh\n    go build -ldflags=\"-w -s\" -o caddy\n  #+end_src\n\n  To build linux binary by this\n  #+begin_src\n  GOOS=linux GOARCH=amd64 go build -ldflags=\"-w -s\" -o caddy\n  #+end_src\n\n  Or you can use the [[https://github.com/caddyserver/xcaddy][xcaddy]] to build the executable file.\n  Ensure you've install it by =go get -u github.com/caddyserver/xcaddy/cmd/xcaddy=\n  #+begin_src sh\n    xcaddy build v2.6.4 --with github.com/sillygod/cdp-cache\n  #+end_src\n\n  Xcaddy also provide a way to develop plugin locally.\n  #+begin_src sh\n    xcaddy run --config cmd/Caddyfile\n  #+end_src\n\n  To remove unused dependencies\n  #+begin_src sh\n    go mod tidy\n  #+end_src\n\n* How to run\n\n  You can directly run with the binary.\n  #+begin_src sh\n    caddy run --config [caddy file] --adapter caddyfile\n  #+end_src\n\n  Or if you are preferred to use the docker\n  #+begin_src sh\n    docker run -it -p80:80 -p443:443 -v [the path of caddyfile]:/app/Caddyfile docker.pkg.github.com/sillygod/cdp-cache/caddy:latest\n  #+end_src\n\n* Configuration\n\n  The following will list current support configs in the caddyfile.\n\n*** status_header\n    The header to set cache status. default value: =X-Cache-Status=\n\n*** match_path\n    Only the request's path match the condition will be cached. Ex. =/= means all request need to be cached because all request's path must start with =/=\n\n*** match_methods\n    By default, only =GET= and =POST= methods are cached. If you would like to cache other methods as well you can configure here which methods should be cached, e.g.: =GET HEAD POST=.\n\n    To be able to distinguish different POST requests, it is advisable to include the body hash in the cache key, e.g.: ={http.request.method} {http.request.host}{http.request.uri.path}?{http.request.uri.query} {http.request.contentlength} {http.request.bodyhash}=\n\n*** default_max_age\n    The cache's expiration time.\n\n*** stale_max_age\n    The duration that a cache entry is kept in the cache, even though it has already expired. The default duration is =0=.\n\n    If this duration is \u003e 0 and the upstream server answers with an HTTP status code \u003e= 500 (server error) this plugin checks whether there is still an expired (stale) entry from a previous, successful call in the cache. In that case, this stale entry is used to answer instead of the 5xx response.\n\n*** match_header\n    only the req's header match the condtions\n    ex.\n\n    #+begin_quote\n    match_header Content-Type image/jpg image/png \"text/plain; charset=utf-8\"\n    #+end_quote\n\n*** path\n    The position where to save the file. Only applied when the =cache_type= is =file=.\n\n*** cache_key\n    The key of cache entry. The default value is ={http.request.method} {http.request.host}{http.request.uri.path}?{http.request.uri.query}=\n\n*** cache_bucket_num\n    The bucket number of the mod of cache_key's checksum. The default value is 256.\n\n*** cache_type\n    Indicate to use which kind of cache's storage backend. Currently, there are two choices. One is =file= and the other is =in_memory=\n\n*** cache_max_memory_size\n\n    The max memory usage for in_memory backend.\n\n*** distributed\n\n    Working in process. Currently, only support =consul= to establish the cluster of cache server node.\n\n    To see a example config, please refer [[file:example/distributed_cache/Caddyfile::health_check \":7777/health\"][this]]\n\n**** service_name\n     specify your service to be registered in the consul agent.\n\n**** addr\n     the address of the consul agent.\n\n**** health_check\n     indicate the health_check endpoint which consul agent will use this endpoint to check the cache server is healthy\n\n\n** Example configs\n   You can go to the directory [[file:example/][example]]. It shows you each type of cache's configuration.\n\n* Benchmarks\n\n  Now, I just simply compares the performance between in-memory and disk.\n\n** Env\n   Caddy run with the config file under directory =benchmark= and tests were run on the mac book pro (1.4 GHz Intel Core i5, 16 GB 2133 MHz LPDDR3)\n\n** Test Result\n\n   The following benchmark is analysized by =wrk -c 50 -d 30s --latency -t 4 http://localhost:9991/pg31674.txt= without log open.\n   Before running this, ensure you provision the tests data by =bash benchmark/provision.sh=\n\n\n   |                         | req/s | latency (50% 90% 99%)     |\n   | proxy + file cache      | 13853 | 3.29ms /  4.09ms / 5.26ms |\n   | proxy + in memory cache | 20622 | 2.20ms /  3.03ms / 4.68ms |\n\n* Todo list\n\n  - [ ] upgrade to the latest caddy\n  - [ ] https://github.com/mastercactapus/caddy2-proxyprotocol\n    https://caddyserver.com/docs/caddyfile/options#listener-wrappers\n    https://github.com/pires/go-proxyproto\n    (add proxy protocol support)\n  - [ ] distributed cache (in progress)\n  - [ ] more optimization..\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsillygod%2Fcdp-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsillygod%2Fcdp-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsillygod%2Fcdp-cache/lists"}