Skip to content

Caching and speed

ClientFence works well with the usual PHP speed-ups. One kind of cache must stay off: a full-page cache in front of the portal.

Cache Where Notes
OPcache PHP setting on the server, or the “Opcode caching” switch in your hosting panel Recommended. It caches compiled PHP code, not pages.
Redis or Memcached System → Settings → System, Cache tab, Cache Backend Needs the PHP extension on the server. Holds settings and lookups, never whole pages.
Browser and CDN caching of files Your CDN (for example Cloudflare) Fine for images, CSS and JavaScript.

The Cache tab with the Cache Backend choice of Filesystem, Redis or Memcached and the Invalidate cache button.

The Cache tab. Use Invalidate cache after you change the configuration or a theme by hand.

Do not put a full-page cache in front of ClientFence pages: no LiteSpeed Cache page caching, Varnish, or CDN rules such as “Cache Everything” for the portal.

Every ClientFence page is built for one visitor at one moment. It carries that visitor’s data and a one-time security code (a script nonce) that the browser checks before it runs the page’s scripts. A cached copy would show one client’s page to another and repeat an old code, so scripts can be blocked by the security policy.

ClientFence already sends its pages with Cache-Control: no-store, so well-behaved caches skip them. Only a cache rule that forces caching would break this.

Run this from the ClientFence directory as the site user to clear the application cache.

Terminal window
php console.php cache:clear