Skip to content

Configuration ​

The settings page (Settings → Plugins → Speedy Cache) has three tabs:

  • General: caching on or off, URLs to never cache, what happens when content changes, and what to rebuild after clearing everything.
  • CDN: your Cloudflare and CloudFront details, and whether Speedy has seen your site behind either.
  • Advanced: the API key, with a button to generate one, and the options below that are only set in config/speedy.php, with the values in use now.

Speedy Cache settings, General tab: a status strip, Cache pages, Never cache, When content changes and After clearing everything

Everything else goes in config/speedy.php. Settings in the file override the settings page, which then shows the field as locked with a note saying so.

php
<?php

use craft\helpers\App;

return [
    // Turn caching off on dev and staging.
    'enabled' => App::env('CRAFT_ENVIRONMENT') === 'production',

    // URL paths that are never cached. * matches anything.
    'neverCache' => ['checkout/*', 'account*', 'search'],

    // Pages to build after everything is cleared: 'sitemap', a list of URLs, or false.
    'warm' => 'sitemap',

    // CDN details, best kept in .env.
    'cloudflareToken' => '$CLOUDFLARE_TOKEN',
    'cloudflareZoneId' => '$CLOUDFLARE_ZONE_ID',
];

All options ​

OptionDefaultDescription
enabledtrueWhether pages are cached
neverCache[]URL paths never cached, such as checkout/*. On the settings page, one per line
queryStrings'skip''skip': pages with a query string aren’t cached. 'ignore': they’re cached without it, for sites that never use query strings for content
ignoredParamsutm_*, gclid, fbclid…Tracking parameters that never stop a page being cached
skipWhenCarttrueDon’t cache for visitors with a Commerce cart
skipCookies[]Cookies that mean a visitor sees their own version of pages, matched by part of the name, such as ['cookie_consent'] (What isn’t cached)
refreshCsrftrueRefresh CSRF tokens on cached pages (Forms)
rebuildClearedtrueRebuild cleared pages in the background before replacing them (Warming)
warmfalsePages to build after a full clear: 'sitemap' or a list of URLs
sitemap'sitemap.xml'The sitemap to read for warm, relative to each site
warmConcurrency2How many pages are built at once
defaultTtlnullA maximum age for every page, in seconds (Live data)
apiKey''A key of 16 characters or more for clearing over HTTP (API). Also on the Advanced tab. Empty turns the API off
cacheCommenttrueAdd <!-- Cached by Speedy Cache on … --> to the end of cached pages
storage'files'Where pages are kept: 'files', or 'craftCache' for Craft’s cache such as Redis, shared by several servers (Multi-site and multiple servers). Also on the Advanced tab
cachePath'@webroot/speedy'Where pages are saved. Must be in the web root for server serving
dataPath'@storage/speedy'Where Speedy keeps tags, the log and CDN details
cloudflareToken, cloudflareZoneIdCloudflare
cloudfrontDistributionId, awsAccessKeyId, awsSecretAccessKeyCloudFront. The keys fall back to AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
cdnMaxAge31536000How long the CDN keeps pages, when Speedy can clear it
wildcardThreshold30CloudFront: more paths than this are grouped into wildcards