Code layout
Architecture
The module class only orchestrates hooks; all the logic lives in dedicated classes under classes/, loaded by a custom autoloader (FaAutoload). Front controllers: warmup (warm-up), refresh (rebuilt pages), vitals (visitor measurements), dynblock (dynamic areas and islands).
| Class | Role |
|---|---|
FaCacheEngine | Orchestrates isCacheable(), serveFromCache(), storePage() and storeListing(). Heart of the read/write cycle. |
FaPageKey | Builds the storage key: hash of the normalised URL + signature of the visit variant (shop, language, currency, device, country, customer groups); detects device from the user agent. |
FaCacheDAO | Database access: cached pages (fa_pc_page), visit variants (fa_pc_variant), links between pages (fa_pc_link), response times (fa_pc_ttfb), warm-up log (fa_pc_warmup_log), scheduled prices, targeted invalidation. |
FaCacheBackendFactory | Selects the configured backend with automatic fallback (Memcached → zip → filesystem) based on what is actually available. |
FaCacheBackendFile / …Zip / …Memcached | Concrete implementations of FaCacheBackend: read, write, purge and flush the storage. |
FaImageOptimizer | Converts images to WebP/AVIF (GD or Imagick) and rewrites <img> tags into <picture>. |
FaHtmlMinifier | Strips extra whitespace and comments from HTML before caching, preserving <pre>/<script>/<style>. |
FaLazyLoader | Rewrites image src to data-src for lazy loading, except explicit exceptions (LCP image, logo…). |
FaDoctor / FaDoctorCheck | A series of environment checks shown in the Diagnostic tab. |
FaWarmup | Scheduled warm-up: the /module/freshappprestacache/warmup?token=… address, called every minute, only runs every 15 minutes, or on every call in boost mode. A run first rebuilds the priority pages (FaRefresh), then requests the home page, categories, products, CMS pages and brands in every language, up to 25 s, resuming where the previous run stopped. Lock file var/warmup.lock shared with the back-office button; log in fa_pc_warmup_log, purged after 30 days. |
FaRefresh | Rebuilds invalidated pages in the background (refresh column and controller), most visited first and for each device; keeps popular pages warm during warm-up. |
FaLcpBooster | Main content image set to fetchpriority="high" and exempted from lazy loading. |
FaVitals | Visitor Core Web Vitals (views/js/vitals.js, vitals controller, fa_pc_vitals table) and 75th percentile for the dashboard. |
FaAudit | Personal block detection: renders compared for two temporary analysis customers (signed internal requests, X-FaPC-Audit). |
FaCdn | Cloudflare or Bunny purge of invalidated pages, batched at the end of the request. |
FaIsland | Personal islands: while a page is built, wraps visitor-specific blocks (signed comments) through the Hook::coreCallHook / coreRenderWidget override; renders their real content for a logged-in customer. |
FaWitness | Inactive witness customers, one per group combination: the shared version of a page is never built from a real customer. |