born05/craft-cache-control

Installs: 178

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 8

Language:TypeScript

Type:craft-plugin


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