{"id":15413658,"url":"https://github.com/lucacasonato/deno_httpcache","last_synced_at":"2025-04-19T12:03:36.946Z","repository":{"id":45607688,"uuid":"344235071","full_name":"lucacasonato/deno_httpcache","owner":"lucacasonato","description":"HTTP Caching for Deno - in memory and redis storage support. Inspired by the Service Worker Cache API.","archived":false,"fork":false,"pushed_at":"2021-10-19T06:52:26.000Z","size":11,"stargazers_count":25,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-06T10:48:48.663Z","etag":null,"topics":["cache","deno","redis","serviceworker"],"latest_commit_sha":null,"homepage":"https://deno.land/x/httpcache","language":"TypeScript","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/lucacasonato.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":"2021-03-03T19:05:00.000Z","updated_at":"2023-11-05T22:08:59.000Z","dependencies_parsed_at":"2022-09-15T05:51:41.433Z","dependency_job_id":null,"html_url":"https://github.com/lucacasonato/deno_httpcache","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucacasonato%2Fdeno_httpcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucacasonato%2Fdeno_httpcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucacasonato%2Fdeno_httpcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucacasonato%2Fdeno_httpcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucacasonato","download_url":"https://codeload.github.com/lucacasonato/deno_httpcache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":220109671,"owners_count":16595984,"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","deno","redis","serviceworker"],"created_at":"2024-10-01T16:58:28.243Z","updated_at":"2024-10-17T17:20:15.649Z","avatar_url":"https://github.com/lucacasonato.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deno_httpcache\n\nHTTP Caching for Deno - in memory and redis storage support. Inspired by the\nService Worker Cache API.\n\n## Usage\n\nSetting, getting, and deleting items in the cache:\n\n```ts\nimport { inMemoryCache } from \"https://deno.land/x/httpcache@0.1.2/in_memory.ts\";\n\nconst cache = inMemoryCache(5);\n\nconst req = new Request(\"https://deno.land/std@0.89.0/version.ts\");\nconst resp = await fetch(req);\n\nawait cache.set(req, resp);\n\nconst cachedResp = await cache.get(req); // or `cache.get(req.url)`\nif (cachedResp === undefined) throw new Error(\"Response not found in cache\");\nconsole.log(cachedResp.status); // 200\nconsole.log(cachedResp.headers.get(\"content-type\")); // application/typescript; charset=utf-8\n\nawait cache.remove(req); // or `cache.remove(req.url)`\nconsole.log(await cache.get(req)); // undefined\n```\n\nAnd with redis:\n\n```ts\nimport { redisCache } from \"https://deno.land/x/httpcache@0.1.2/redis.ts\";\n\nconst cache = await redisCache(\"redis://127.0.0.1:6379\");\n\n// you can also optionally specify a prefix to use for the cache key:\nconst cache = await redisCache(\"redis://127.0.0.1:6379\", \"v1-\");\n```\n\n## Contributing\n\nBefore submitting a PR, please run these three steps and check that they pass.\n\n1. `deno fmt`\n2. `deno lint --unstable`\n3. `deno test --allow-net` _this requires you to have a redis server running at\n   127.0.0.1:6379_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucacasonato%2Fdeno_httpcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucacasonato%2Fdeno_httpcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucacasonato%2Fdeno_httpcache/lists"}