Directory / plugin
Flash Cache
v4.0 · by etruel
Static page cache served by your web server, without PHP: cache rules per page type, background refreshes and lighter CSS and JavaScript.
About this plugin
Flash Cache turns every page of your WordPress site into a static file that Apache, nginx or LiteSpeed sends straight to your visitors, without starting PHP or WordPress. A cached page is delivered in a few milliseconds, your server keeps its resources for the visitors and tasks that really need them, and your site stays fast when traffic peaks.
It is built around one principle: performance comes first. Every feature is designed so that serving a cached page costs nothing, and keeping the cache fresh costs as little as possible.
Measured, not promised. On our Apache test site (WordPress 7.1, PHP 7.4), the home page took 102 ms to start arriving and the server answered 18 requests per second without a cache. With Flash Cache it started arriving in 0.85 ms, the same server answered more than 23,000 requests per second, and each visit carried 5.8 KB instead of 43 KB.
What sets Flash Cache apart
- Truly static pages. Cached pages are served by the web server’s own rules. Visits to a fresh page never start WordPress, not even to check whether the page has expired: the page knows its own age, and only once its minimum lifetime has passed does it ask for a refresh, in the background.
- Cache patterns: one set of rules for each kind of page. Decide how the front page, posts, pages, categories, tags, author pages, archives, search results and feeds are cached, with their own lifetimes, for some post types or for URLs containing a given text. Drag the patterns into the order you want: the first one that applies to a page decides how it is cached, and a “Don’t cache” type keeps any page live.
- Pages with query strings get cached too. Search results, filtered lists and other dynamic pages can be stored in PHP mode: a compact cache file serves the stored copy of each variant with a single lookup. Visits with tracking parameters (utm_*, fbclid, gclid and similar) share the same copy, and each page keeps a bounded number of variants.
- Visitors never meet an empty cache. Only one refresh per page runs at a time, however many visitors arrive when it expires. New posts are rebuilt in the background right after you publish, so saving stays instant. On large sites, design changes replace the cached pages a few at a time instead of throwing the whole cache away.
- Always up to date, by itself. Publishing or updating a post refreshes its page, the home page and its category and tag archives. Approved comments refresh their post. Saving widgets, menus, Customizer settings, block theme templates or synced patterns refreshes the cache automatically, and switching themes starts a fresh one.
- Emptying the cache is instant, at any size. The files are set aside at once and removed in the background, so large sites never wait or time out.
- Preload the whole site. A background crawler warms the cache in small batches, with the batch size and the pause between batches under your control, and can include the category and tag archives of every post.
- Lighter pages. Styles and scripts are combined into fewer files, read straight from disk and shared by every page that uses the same assets. Theme scripts, plugin scripts, inline scripts or single files can stay in place with one switch each.
- Faster for returning visitors. Every static page is stored ready-compressed with gzip, and the browser cache time is yours to choose.
- Light on the server, even when nothing is cached yet. Flash Cache reads its settings once per request, loads its patterns from a single stored option instead of database queries, and on PHP-FPM servers releases the visitor’s connection before a page is rebuilt.
- Clean and portable. No drop-in files and no changes to wp-config.php. The server rules live in their own marked blocks of .htaccess or nginx.conf, and deactivating the plugin removes the rules and the cache. Moving your site to another host or domain is just as easy as with no cache at all.
- You always know what is in the cache. Cache statistics show static pages, PHP pages, styles, scripts and fonts with their size and count, they load instantly at any cache size, and on nginx and OpenLiteSpeed the settings screen tells you whether the server is running the current rules.
- Made for autoblogs and busy sites. Bulk publishing, such as a WPeMatico fetch, rebuilds each new post’s page and refreshes the home page and each archive once per batch.
Also included
- Redirect HTTP to HTTPS, with a Strict-Transport-Security header for the site’s own host.
- Choose which visitors skip the cache by cookie. Logged-in users, commenters and password-protected posts are always served live.
- Form submissions always reach WordPress: only GET and HEAD requests are cached.
- A lock file or a database lock keeps two visitors from building the same page at the same time.
- A custom cache folder, validated on save.
- Settings, cache and preload actions reserved to users with the matching permissions.
- Clear settings screens grouped by topic (General, Cache updates, Advanced options and Optimization), each with its own save and reset.
- Ready for translation, with community translations at translate.wordpress.org.
- For developers: the
flash_cache_clear_urlaction refreshes the cached copy of any page your code changed, every block of server rules is filterable, and definingFLASH_CACHE_DEBUGsends a debug log to the PHP error log.
Works where your site runs
- Web servers: Apache, LiteSpeed Enterprise, OpenLiteSpeed and nginx.
- PHP 7.2 or later and WordPress 5.9 or later, on single WordPress sites.
- Tested with WPeMatico and its add-ons.
Flash Cache Pro
Everything described above is free and complete: Flash Cache does not hold back its core to sell an upgrade. Flash Cache Pro supports its continued development and adds a few extras for professional sites:
- Widgets and blocks without cache: mark a block or a legacy widget as live, so it is rendered fresh on every visit while the rest of the page stays cached, optionally refreshed every few minutes.
- Shared widget cache: widgets that look the same on every page are built once and shared by all cached pages, and updating them never empties the cache.
- Minify styles and scripts: the combined files lose spaces and comments, so they weigh less.
- Google Fonts on your server: pages make fewer requests to other sites.
- Leave chosen plugins’ scripts in place, one plugin at a time.
- Per-post tools: clear a single post’s cache from the posts list, and rebuild it automatically when you save.
Known third-party compatibility issues
In some cases other plugins insert scripts or styles in an unusual way that the script optimization cannot follow. Leave those scripts in place from the Optimization screen.
Shortcodes Ultimate: Uncaught ReferenceError: SUShortcodesL10n is not defined. Leave its scripts in place.
Translations
Many thanks to the generous efforts of all translators.
If you’d like to help out by translating this plugin, please sign up for an account and dig in.
External services
Flash Cache connects to a service only when you press a button that says so:
- “I’m interested in LiteSpeed Enterprise” (About > Servers), operated by us at flashcache.net (privacy policy). Pressing it sends your choice, whether this site runs LiteSpeed Enterprise, the Flash Cache and PHP versions, the site language and a random anonymous ID that is not derived from your site address. If you also tick the box to be emailed when it is ready, it sends the email address you type, and the note if you write one. Nothing is sent until you press the button.