{"repo":"koajs/cash","free":true,"listed":false,"github":"https://github.com/koajs/cash","clone":"git clone https://github.com/koajs/cash.git","description":"HTTP response caching for Koa. Supports Redis, in-memory store, and more!","language":"JavaScript","stars":157,"topics":["cache","caching","koa","node","javascript","redis","memory","store","storage","s3"],"license":"MIT","category":"databases-storage","readme_excerpt":"koa-cash HTTP response caching for Koa. Supports Redis, in-memory store, and more! Table of Contents Features Install Usage API app.use(koaCash(options)) Max age (optional) CashClear Notes Contributors License Links Features Caches the response based on any arbitrary store you'd like. Handles JSON and stream bodies Handles gzip compression negotiation (if options.compression is set to true as of v4.0.0) Handles 304 responses :tada: Pairs great with @ladjs/koa-cache-responses :tada: Install NPM Usage API app.use(koaCash(options)) Options are: maxAge Default max age (in milliseconds) for the cache if not set via await ctx.cashed(maxAge) . threshold Minimum byte size to compress response bodies. Default 1kb . compression If a truthy value is passed, then compression will be enabled. This value is false by default. setCachedHeader If a truthy value is passed, then X-Cached-Response header will be set as HIT when response is served from the cache. This value is false by default. methods If an object is passed, then add extra HTTP method caching. This value is empty by default. But GET and HEAD are enabled. Eg: { POST: true } hash() A hashing function. By default, it's: ctx is the Koa context and is also passed as an argument. By default, it caches based on the URL. get() Get a value from a store. Must return a Promise, which returns the cache's value, if any. Note that all the maxAge stuff must be handled by you. This module makes no opinion about it. set() Set a value to a store.","default_branch":null,"files":null,"tree":[],"storefront":"/r/koajs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/koajs/cash/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}