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
| Saff ta' wara | Użah meta |
|---|---|
memory | You need the fastest cache and can keep objects in RAM. |
disk | You need cache capacity that survives process restarts. |
tiered | You want memorja għal hot objects u diska għal larger capacity. |
storage-bin | You expect high churn u want limitat diska allocation. |
encrypted disk | You 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
| Kontroll | Għan |
|---|---|
lock | Collapse concurrent misses so one request fills the cache. |
range.slice | Cache fixed byte slices for large files and resumable downloads. |
peer_fill | Let one edge fill minn another edge qabel using origin. |
origin_protection | Limit concurrent origin fills waqt high pressure. |
cache_purger | Clean stale diska entries in limitat batches. |
Use cache carefully
- Talbiet li jġorru
AuthorizationjewProxy-Authorizationdejjem jaqbdu t-tiftix u l-ħażna tal-cache maqsuma. - Reazzjoni ħażina jew konfliġġenti Id-direttivi
Cache-Controlhuma miċħuda minflok ma jaqgħu lura għal TTLs konfigurati;s-maxagejieħu prijorità fuqmax-age. must-revalidate,proxy-revalidate, us-maxagejipprojbixxu l-użu mill-ġdid frisk wara li tiskadi l-freskezza.- Keep cache keys bounded and predictable.
- Uża root storage-bin wieħed għal kull proċess Fluxheim li jkun qed jaħdem; is-sjieda tuża lock konsultattiv tal-filesystem u roots kondiviżi b’aktar minn writer wieħed mhumiex sikuri mingħajr locking estern ivverifikat.
- Uża purge jew TTLs qosra meta l-kontenut jinbidel spiss.
- Bypass on cookies, preview headers, and unsafe query strings.
Nota ta' aġġornament tal-cache encrypted
Fluxheim 1.7.12 iċċaqlaq oġġetti tal-cache tad-disk encrypted għal dejta marbuta mal-għeruq u ċwievet indiċi bi stat nonce durabbli. L-ewwel startup kontra għerq kriptat antik, u kull rotazzjoni taċ-ċavetta lokali, intenzjonalment tnaddaf dik il-cache qabel ma sservi t-traffiku.
- Ittratta l-cache encrypted bħala aċċelerazzjoni li tintrema, mhux is-sors tar-rekord.
- Agħti kull għerq tal-cache ħażna privata persistenti u tikkopja l-istat nonce bejn għeruq indipendenti.
- Ippjana l-kapaċità tal-oriġini għall-ewwel tisħin wara li ttejjeb jew iddawwar iċ-ċwievet.