=== SuperHertz Cache Preloader ===
Contributors: superhertzbiz, superhertz
Tags: litespeed, cache, preloader, warmer, performance
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

High-performance cache warming companion for LiteSpeed Cache. Crawls and preloads your entire site so first-time visitors always get lightning-fast cached pages.

== Description ==

**SuperHertz Cache Preloader** is a powerful companion plugin for [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/) that ensures your pages, posts, products, and custom post types are always pre-warmed in the cache — so no visitor ever hits a cold, uncached page.

= Why You Need a Cache Preloader =

LiteSpeed Cache is incredibly fast, but it only caches pages *after* the first visitor requests them. That first visitor gets a slow, uncached response. This plugin solves that by proactively crawling every public URL on your site to build the cache before any real visitor arrives.

= Key Features =

* **Automatic Site Crawling** — Discovers and warms all public pages, posts, products (WooCommerce), and custom post types automatically.
* **Parallel Processing Engine** — Multi-threaded cURL engine processes multiple URLs simultaneously for faster warm-up times.
* **Sequential Mode** — Optional single-threaded mode for shared hosting or resource-constrained environments.
* **Smart Throttle Guard** — Automatically reduces concurrency when server RAM exceeds 85% or CPU load exceeds 5.0 to protect your server.
* **TTFB Latency Tracking** — Monitors Time To First Byte per URL and flags slow pages (> 2.0s).
* **Server Load Monitoring** — Real-time dashboard cards showing Memory Footprint, CPU Load, OpCache status, and Database Query metrics.
* **Configurable Concurrency** — Set parallel thread count from 2x to 25x based on your server capacity.
* **Adjustable Rest Delay** — Configure pause between requests (0ms to 500ms) to balance speed vs. server load.
* **Scheduled Cron Warming** — Set automatic daily, twice-daily, or hourly cache warming with custom start times.
* **Manual One-Click Warming** — Trigger a full cache warm-up from the admin dashboard at any time.
* **Per-URL Debug Logging** — Detailed console showing HTTP status, TTFB, cache HIT/MISS status, and LiteSpeed headers for every URL.
* **Auto Log Clearing** — Debug logs automatically clear on each new run for clean diagnostics.
* **Smart Cache Bypass** — Automatically excludes cart, checkout, account, and dashboard pages from warming.
* **Admin Bar Protection** — Prevents WordPress Admin Bar from being cached for non-admin users (vendors, customers, guests).
* **ESI-Aware Crawling** — Sends proper ESI and cache-control headers during warm-up requests.
* **V8 Module Pre-Warming** — Injects `modulepreload` hints for JavaScript bundles to eliminate client-side cold starts.
* **WP-CLI Support** — Run cache warming from the command line with `wp superhertz-cache-preloader warm`.
* **Full-Width Admin Panel** — Clean, modern dashboard UI that uses your full screen width.

= How It Works =

1. The crawler engine queries WordPress for all published pages, posts, products, and custom post types.
2. It builds a URL queue and sends HTTP requests (with LiteSpeed-compatible headers) to each URL.
3. LiteSpeed Cache intercepts these requests and stores the rendered pages in its cache.
4. When a real visitor arrives, they get the pre-cached version instantly.

= Server Requirements =

* LiteSpeed Web Server (OpenLiteSpeed or LiteSpeed Enterprise)
* [LiteSpeed Cache plugin](https://wordpress.org/plugins/litespeed-cache/) installed and activated
* PHP 7.4 or higher
* WordPress 5.8 or higher

== Installation ==

1. Upload the `superhertz-cache-preloader` folder to the `/wp-content/plugins/` directory, or install directly through the WordPress plugin screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Navigate to **Settings → LiteSpeed Warmer** in your WordPress admin.
4. Configure your preferred concurrency level, rest delay, and cron schedule.
5. Click **Run Cache Warm-Up** to perform your first manual warming.

== Frequently Asked Questions ==

= Does this plugin replace LiteSpeed Cache? =

No. This plugin is a **companion** to LiteSpeed Cache. You must have LiteSpeed Cache installed and activated. This plugin simply ensures the cache is pre-populated so no visitor ever hits a cold page.

= Will this overload my server? =

No. The plugin includes a **Smart Throttle Guard** that automatically reduces concurrency when RAM usage exceeds 85% or CPU load exceeds 5.0. You can also switch to sequential mode or increase the rest delay between requests for shared hosting environments.

= Does it work with WooCommerce? =

Yes. The crawler automatically discovers and warms all WooCommerce product pages, shop pages, and category archives.

= Can I exclude certain pages from warming? =

Yes. Cart, checkout, account, and dashboard pages are automatically excluded since they contain dynamic, user-specific content that should never be cached.

= Does it support WP-CLI? =

Yes. You can trigger a cache warm-up from the command line:

`wp superhertz-cache-preloader warm`

= What is the V8 Module Pre-Warming feature? =

It injects `<link rel="modulepreload">` tags in the page head for JavaScript bundle files, allowing browsers to pre-parse and compile JS modules before they are needed — reducing client-side startup time.

= Why is the Admin Bar being cached for guests? =

This plugin automatically strips the WordPress Admin Bar for all non-administrator users (vendors, customers, subscribers, and guests) to prevent it from being cached by LiteSpeed and served to the wrong users.

== Screenshots ==

1. Main dashboard with one-click warming, concurrency settings, and cron scheduling.
2. Real-time server load monitoring cards (Memory, CPU, OpCache, Throttle Guard).
3. Per-URL debug console showing HTTP status, TTFB, and cache hit/miss for every crawled URL.

== Changelog ==

= 1.0.1 =
* Maintenance update for WordPress repository compliance.
* Improved manifest path resolution for module preloading.
* Performance optimizations for crawler throttling.

= 1.0.0 =
* Initial release.
* Parallel and sequential crawling engines.
* Smart Throttle Guard with RAM and CPU monitoring.
* TTFB latency tracking and slow page detection.
* Scheduled cron warming (daily, twice-daily, hourly).
* Per-URL debug logging with auto-clear.
* WP-CLI support.
* Admin Bar purification for non-admin users.
* ESI-aware crawler headers.
* V8 module preloading.
* Smart cache bypass for checkout, cart, account, and dashboard pages.

== Upgrade Notice ==

= 1.0.1 =
Recommended update for WordPress repository compatibility and improved crawler stability.

= 1.0.0 =
Initial release. Install and configure under Settings → LiteSpeed Warmer.
