Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/live/blocks/loader.ts>LoaderModule

Git-based Visual CMS for Deno, </> htmx and Tailwind apps. Deploy on any Deno-compatible host.
Go to Latest
interface LoaderModule
implements BlockModule<FnProps<TProps>>
import { type LoaderModule } from "https://deno.land/x/live@1.103.0/blocks/loader.ts";

Type Parameters

optional
TProps = any
optional
TState = any

Properties

optional
cache: "no-store" | "stale-while-revalidate" | "no-cache"

Specifies caching behavior for the loader and its dependencies.

  • no-store:

    • Completely bypasses the cache, ensuring that the loader always runs and fetches fresh data.
    • This setting also changes ctx.vary.shouldCache to false, which prevents other dependent sections from being cached.
    • The vary is not set, even if the loader has a cache key.
  • no-cache:

    • Ignores the cache for the current loader run, but does not affect the caching behavior of other dependent blocks.
    • This is useful for loaders that should always execute but whose results can still be cached.
  • stale-while-revalidate:

    • If no data exists for a cache key, the loader runs, and the fresh data is returned.
    • If stale data is available, it is returned immediately while the loader runs in the background to revalidate and update the cache if the data is outdated.
optional
cacheKey: (
props: TProps,
req: Request,
) => string | null
optional
deprecated
singleFlightKey: SingleFlightKeyFunc<TProps, HttpContext>