https://github.com/born05/sveltekit-cache-control
https://github.com/born05/sveltekit-cache-control
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/born05/sveltekit-cache-control
- Owner: born05
- License: mit
- Created: 2024-04-15T11:57:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-18T19:48:57.000Z (over 1 year ago)
- Last Synced: 2024-12-30T05:56:49.467Z (over 1 year ago)
- Language: TypeScript
- Size: 396 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SvelteKit Cache Control
A simple way to add control caching in your SvelteKit project.
Install:
```
npm i -D @born05/sveltekit-cache-control
```
Example usage:
```ts
import { sequence } from '@sveltejs/kit/hooks';
import type { Handle } from '@sveltejs/kit';
import { proxyHandle } from '@born05/sveltekit-cache-control';
const svelteHandle: Handle = async ({ event, resolve }) => {
const response = await resolve(event);
return response;
};
export const handle = sequence(
cacheControlHandle(env.REDIS_URL, { etagCacheKey: 'some-etag' }),
svelteHandle,
);
```