Skip to content
This repository was archived by the owner on Oct 25, 2026. It is now read-only.

Caching and Performance

Syed Ahmer Shah edited this page Oct 25, 2026 · 2 revisions

Cache layers

Layer What is cached Lifetime and invalidation
1. Browser / CDN Vite assets, fonts max-age=31536000, immutable; file names change every build
Film art and trailers 30 days plus a week of stale-while-revalidate (public/.htaccess)
HTML and JSON Never shared (live seat counts, session cookies)
2. Service worker App shell, build assets, icons Cache-first (bmm-shell-v3, bmm-assets)
Film art, share images, trailer stills Stale-while-revalidate, capped at 120 entries (bmm-media)
Booking pages Network-first with offline fallback; wiped on sign-out (bmm-tickets)
3. Application cache Home rails, navbar films, footer genres and cinemas Cache::flexible: fresh 5–60 min, then served stale while one locked request rebuilds; cleared by model events
Site settings, ban lists, assistant facts, admin analytics Cache::remember, 1–10 minutes, cleared on write
4. Per-request memo Layout data shared by every Inertia response LayoutData::remember()
5. Database Reporting views and composite indexes One query per seat map or dashboard

Media delivery

  • Images: WebP in two sizes (card.webp 1200 px + card-sm.webp 640 px, hero.webp 1600 px + hero-sm.webp 960 px) with srcset/sizes, explicit dimensions, lazy loading below the fold and fetchpriority="high" on the largest paint.
  • LCP preload: film pages and the home page emit <link rel="preload" as="image" imagesrcset=...> from the server.
  • Trailers: VP9 WebM first, H.264 MP4 fallback, WebP still. They autoplay muted only when motion is allowed, Data Saver is off and the connection is faster than 3G.
  • Code splitting: every page and each Three.js scene is its own chunk.

Clone this wiki locally