-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Rocket automatically works out which channel entries each page uses, and refreshes its cache whenever those entries are updated in the control panel.
Dramatically improve your TTFB metric. Reduce server resource load.
If a page has any dynamic content, you will need to load it in via AJAX as the HTML output will load from the cache. If your site has plugins which work with channel entries, Rocket might need some extra work to be compatible (currently supports: Low Reorder). If your site is using HTTPAUTH, Rocket will be unable to create cache files
Cache is purged whenever the addon settings are saved. Rocket works with Apache/NGINX. Rocket does not work with the PHP built in server, because 2 request threads are required.
Go even faster, add the following code to the top of index.php for super fast GET requests. Note - this code ignores the 'Website online?' control panel setting. If a cache exists for a page it will be shown even if the site is 'offline'.
// START ROCKET
if (session_start() && !empty($_SESSION['ROCKET_CSRF']) && $_SERVER['REQUEST_METHOD'] != 'POST' && !isset($_GET['rocket_bypass'])) {
$p = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'rocket_cache';
if (file_exists($p . DIRECTORY_SEPARATOR . 'enabled')) {
if (!isset($_COOKIE['loggedin']) || !file_exists($p . DIRECTORY_SEPARATOR . 'bypass')) {
$f = $p . DIRECTORY_SEPARATOR . base64_encode($_SERVER['REQUEST_URI']) . '.html';
if (file_exists($f)) {
die(str_replace(
'{{ROCKET_CSRF}}',
'<input type="hidden" name="csrf_token" value="'.$_SESSION['ROCKET_CSRF'].'" />',
file_get_contents($f)
));
}
}
}
}
// END ROCKET