KScript Dokumentation
DE

Sprache

Automatisch aus dem Englischen übersetzt; das englische Original ist maßgeblich.

Caching: KScript.Cache

HTTP-Caching

KScript.Http nutzt KScript.Cache für das HTTP-Caching. Eine Route kann ihre Antworten mit einem ETag kennzeichnen, 304 Not Modified antworten, wenn der Browser bereits die neueste Antwort hat, Cache-Control setzen und ganze Antworten im Speicher-Cache halten:

<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')
}

Siehe Caching und ETags für die Details.