KScript docs
EN

Caching: KScript.Cache

HTTP caching

KScript.Http uses KScript.Cache for HTTP caching. A route may tag its answers with an ETag, answer 304 Not Modified when the browser already has the latest answer, set Cache-Control, and keep whole answers in the memory cache:

<KScript.Routes>
  <import path="controllers/people.kscript" as="people" />

  <Get path="/people" to="people.index" etag="true" cache="60" />
  <Get path="/stats" to="people.stats" middleware="'cache_response:5m'" />
</KScript.Routes>
import KScript.Http
import "controllers/people.kscript" as people

Routes {
  Get(path: /people, to: @people.index, etag: true, cache: 60)
  Get(path: /stats, to: @people.stats, middleware: 'cache_response:5m')
}

See Caching and ETags for the details.

Edit this page on GitHub