{"id":16978097,"url":"https://github.com/codeaholicguy/fastify-response-caching","last_synced_at":"2025-03-22T14:31:55.321Z","repository":{"id":48517197,"uuid":"296209948","full_name":"codeaholicguy/fastify-response-caching","owner":"codeaholicguy","description":"A Fastify plugin for caching the response","archived":false,"fork":false,"pushed_at":"2022-12-05T11:24:22.000Z","size":143,"stargazers_count":18,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T12:03:49.158Z","etag":null,"topics":["fastify","fastify-response-caching","response-caching"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/codeaholicguy.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-09-17T03:33:36.000Z","updated_at":"2025-01-16T22:23:55.000Z","dependencies_parsed_at":"2023-01-24T04:31:36.540Z","dependency_job_id":null,"html_url":"https://github.com/codeaholicguy/fastify-response-caching","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaholicguy%2Ffastify-response-caching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaholicguy%2Ffastify-response-caching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaholicguy%2Ffastify-response-caching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaholicguy%2Ffastify-response-caching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeaholicguy","download_url":"https://codeload.github.com/codeaholicguy/fastify-response-caching/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244972344,"owners_count":20540964,"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":["fastify","fastify-response-caching","response-caching"],"created_at":"2024-10-14T01:42:31.450Z","updated_at":"2025-03-22T14:31:54.987Z","avatar_url":"https://github.com/codeaholicguy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastify-response-caching\n\n![Node.js CI](https://github.com/codeaholicguy/fastify-response-caching/workflows/Node.js%20CI/badge.svg)\n\n*fastify-response-caching* is a plugin for the [Fastify](http://fastify.io/) framework \nthat provides mechanisms for caching response to reduce the server workload.\n\nBy default, this plugin implements caching by request URL (includes all query parameters)\nwith the caching time (TTL) is 1 seconds. Besides, this plugin also supports additional caching condition\nsuch as request headers.\n\n## Example\n\nThis example shows using the plugin to cache response with default options.\n\n```js\nconst fastify = require('fastify')\nconst fastifyResponseCaching = require('fastify-response-caching')\n\nfastify.register(fastifyResponseCaching)\n```\n\nThis example shows using the plugin to cache response with customized caching time.\n\n```js\nconst fastify = require('fastify')\nconst fastifyResponseCaching = require('fastify-response-caching')\n\nfastify.register(fastifyResponseCaching, {ttl: 5000})\n```\n\nThis example shows using the plugin to cache response with customized caching conditions.\n\n```js\nconst fastify = require('fastify')\nconst fastifyResponseCaching = require('fastify-response-caching')\n\nfastify.register(fastifyResponseCaching, {ttl: 5000, headers: ['x-request-agent']})\n```\n\n## API\n\n### Options\n\n*fastify-response-caching* accepts the options object:\n\n```js\n{\n  ttl: \u003cNumber\u003e\n  additionalCondition: {\n    headers: \u003cArray\u003cString\u003e\u003e\n  }\n}\n```\n\n+ `ttl` (Default: `1000`): a value, in milliseconds, for the lifetime of the response cache.\n+ `additionalCondition` (Default: `undefined`): a configuration of additional condition for caching.\n+ `additionalCondition.headers` (Default: `[]`): a list of string, headers that you want to include in the caching condition.\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeaholicguy%2Ffastify-response-caching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeaholicguy%2Ffastify-response-caching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeaholicguy%2Ffastify-response-caching/lists"}