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
| Backend lucale | Usalo quanno |
|---|---|
memory | You need the fastest cache and can keep objects in RAM. |
disk | You need cache capacity that survives process restarts. |
tiered | Vuoi memory pe oggetti caldi e disk pe capacità maggiore. |
storage-bin | Ti aspetti churn alto e vuoi allocazione disk bounded. |
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
| Controllo | Scopo |
|---|---|
lock | Collapse concurrent misses so one request fills the cache. |
range.slice | Cache fixed byte slices for large files and resumable downloads. |
peer_fill | Permetti a nu edge 'e riempire da nu altro edge primma 'e usare origin. |
origin_protection | Limita 'e fill origin concorrenti durante pressione alta. |
cache_purger | Pulisci entry disk stale in batch bounded. |
Use cache carefully
- 'E richieste cu
AuthorizationoProxy-Authorizationsaltano sempe 'a ricerca e 'o salvataggio dint''a cache condivisa. - 'E direttive 'e risposta
Cache-Controlmalformate o 'n cunflitto veneno rifiutate invece 'e turnà ê TTL configurate;s-maxagetene priorità ncopp''amax-age. must-revalidate,proxy-revalidatees-maxagevietano 'e riusà dati stantie doppo ca fernesce 'a freschezza.- Keep cache keys bounded and predictable.
- Usa na root storage-bin pe ogne processo Fluxheim in esecuzione; ’a proprietà usa nu lock consultivo d’ ’o filesystem e ’e root condivise cu cchiù writer nun so’ sicure senza locking esterno verificato.
- Usa purge o TTL brevi quanno 'o contenuto cambia spesso.
- Bypass on cookies, preview headers, and unsafe query strings.
Nota pe ll'aggiornamento d''a cache cifrata
Fluxheim 1.7.12 sposta ll'oggette d''a cache cifrata ncopp''o disco a chiave 'e date e indice legate â radice, cu nu stato nonce durevole. 'O primmo avvio ncopp''a na radice cifrata cchiù vecchia e ogne rotazione d''a chiave locale fanno apposta na pulizia a friddo d''a cache primma 'e servì 'o traffico.
- Tratta 'a cache cifrata comme accelerazione ca se pò jettà, no comme fonte ufficiale d''e date.
- Dà a ogne radice d''a cache nu spazio privato persistente e nun cupià 'o stato nonce fra radice indipendente.
- Pianifica 'a capacità d''o server d''origine pe 'o primmo riscaldamento doppo ll'aggiornamento o 'a rotazione d''e chiave.