Cache

Use cache when Fluxheim sits in front of an origin and repeated responses should be served faster.

Proxy cache example

[cache]
enabled = true
default_ttl_secs = 300
max_object_bytes = "32MiB"
status_header = "X-Cache-Status"

[cache.memory]
enabled = true
max_size_bytes = "256MiB"

[cache.disk]
enabled = true
path = "/var/cache/fluxheim/site"
max_size_bytes = "10GiB"

Cache backends

CúltacaÚsáid é nuair
memoryYou need the fastest cache and can keep objects in RAM.
diskYou need cache capacity that survives process restarts.
tieredYou want cuimhne do hot objects agus diosca do larger capacity.
storage-binYou expect high churn agus want teoranta diosca allocation.
encrypted diskYou need cache-at-rest protection for disk objects.

Route cache policy

[[vhosts.routes]]
name = "assets"
path_prefix = "/assets/"
action = "proxy"

[vhosts.routes.proxy]
upstreams = ["127.0.0.1:3000"]

[vhosts.routes.cache]
enabled = true
status_ttls = { "200" = 3600, "404" = 60 }
content_types = ["text/css", "application/javascript", "image/*"]
extensions = ["css", "js", "png", "webp", "svg"]
include_query = false
stale_while_revalidate_secs = 30
stale_if_error_secs = 120

Advanced cache controls

RialúCuspóir
lockCollapse concurrent misses so one request fills the cache.
range.sliceCache fixed byte slices for large files and resumable downloads.
peer_fillLet one edge fill ó another edge roimh using origin.
origin_protectionLimit concurrent origin fills le linn high pressure.
cache_purgerClean stale diosca entries in teoranta batches.

Use cache carefully

  • Seachnaíonn iarratais a iompraíonn AuthorizationProxy-Authorization cuardach agus stóráil taisce comhroinnte i gcónaí.
  • Freagra míchumtha nó contrártha diúltaítear do threoracha Cache-Control in ionad titim siar ar TTLanna cumraithe; Tugtar tosaíocht do s-maxage thar max-age.
  • Cuireann must-revalidate, proxy-revalidate, agus s-maxage cosc ar athúsáid stale tar éis don úire dul in éag.
  • Keep cache keys bounded and predictable.
  • Úsáid fréamh storage-bin amháin do gach próiseas Fluxheim atá ag rith; úsáideann úinéireacht glas comhairleach córas comhad agus níl fréamhacha comhroinnte ilscríbhneora sábháilte gan glasáil sheachtrach fhíoraithe.
  • Use purge nó short TTLs when content changes often.
  • Bypass on cookies, preview headers, and unsafe query strings.

Nóta uasghrádaithe criptithe-taisce

Bogann Fluxheim 1.7.12 oibiachtaí taisce diosca criptithe go dtí na heochracha sonraí agus na heochracha innéacs atá ceangailte le fréamh le staid marthanach nonce. Déanann an chéad tosaithe i gcoinne fréamh criptithe níos sine, agus gach uainíocht áitiúil-eochair, glanadh d'aon ghnó an taisce sin sula bhfreastalaíonn sé ar thrácht.

  • Tá sonraí an taisce chriptithe indiúscartha agus ní ceadmhach iad a úsáid mar fhoinse údarásach sonraí.
  • Tabhair stór príobháideach marthanach do gach fréamh taisce agus ná cóipeáil aon stát idir fréamhacha neamhspleácha.
  • Pleanáil acmhainn tionscnaimh don chéad téamh suas tar éis eochracha a uasghrádú nó a rothlú.
Gaeilge