born05/craft-cache-control

Installs: 71

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 5

Language:TypeScript

Type:craft-plugin

1.4.4 2024-10-29 11:02 UTC

README

A simple way to add control caching in your SvelteKit project.

Install:

npm i -D @born05/sveltekit-cache-control

Example usage:

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,
);