Alepha Server Cache
Adds ETag and Cache-Control headers to server responses.
Installation
This package is part of the Alepha framework and can be installed via the all-in-one package:
npm install alepha
Alternatively, you can install it individually:
npm install @alepha/core @alepha/server-cache
Module
Plugin for Alepha Server that provides server-side caching capabilities. It uses the Alepha Cache module to cache responses from server actions ($action). It also provides a ETag-based cache invalidation mechanism.
import { Alepha } from "alepha";
import { $action } from "alepha/server";
import { AlephaServerCache } from "alepha/server/cache";
class ApiServer {
hello = $action({
cache: true,
handler: () => "Hello, World!",
});
}
const alepha = Alepha.create()
.with(AlephaServerCache)
.with(ApiServer);
run(alepha);
Table of contents