Getting Started

Deployment Deployment - Diagnose Migrations Staging

Site Management

Backups Client Reporting Passwords Plugin Automation Plugin Management - Global Plugins & Themes - Diagnose Plugins & Themes - General Plugins & Themes - Git Plugins & Themes - Logs Must Install White Label WordPress Updates

Caching & Performance

Caching Caching - Blogs/Articles Caching - Diagnose Caching - Git Caching - WooCommerce Redis Optimize & Scale

Security

Security Security - Firewall

SMTP, CDN & DNS

SMTP SendGrid CDN CDN - AWS CDN - Cloudflare CDN - Diagnose Domains & DNS

Server & Tools

Analytics & Logs CRON Jobs Database Debug Tool Git Monitoring PHP Settings Redirects SEO Tools Server Errors sFTP SSL

Staq Billing

Staq Billing > Account Staq Billing > Client Staq Billing > Setup

Media

Media Media - Diagnose Media - Optimize

Accounts & Billing

Accounts & Billing

General

WordPress Hosting Website Diagnose Troubleshoot - Other

Nonce and Cache TTL


On this page

    What is a Nonce?

    A nonce, or “number used once,” is a unique token generated by WordPress to verify the origin and intent of requests, particularly in forms and AJAX calls. By default, WordPress sets nonces to expire after 12 hours, although some plugins may extend this to 24 hours for specific functionalities.

    Why Nonces Require Special Treatment?

    Nonces are vital for security, but once they expire, they become invalid and functions they’re tied to (such as Forms and AJAX requests) will not function.

    Available Cache TTL Settings for Clearance

    Staq prioritizes performance optimization by disabling the Global Time To Live (TTL) setting by default instead of the blanket N-hour sTTL approach used by other hosting platforms or caching plugins.

    Reasoning Behind Not Setting Global Cache TTL to 10 Hours

    By dynamically managing cache expiration based on nonce validity, Staq optimizes performance while maintaining SEO integrity. This approach ensures that only pages with expired nonces are deleted, preventing unnecessary removal of unaffected pages that could otherwise slow down your website.

    Commands for Cache Deletion

    To delete expired cached files, Staq runs the WP CLI command “wp wpstaq clear-expired-cache” hourly. This initiates a scan of cached files. Staq first checks the global TTL setting for expiration. If not expired, it then evaluates the nonce rules TTL. Should the nonce TTL be exceeded, Staq inspects the content for nonces, deleting the cache if necessary.

    Verification of Cache Deletion

    To verify cache deletion:

      1. Check Cache Creation Timestamps: Inspect HTML source code for the Staq cache creation timestamp, typically located near the end of the document:<!-- Cached & Optimized by Staq (https://www.wpstaq.com): YYYY-MM-DD HH:MM:SS GMT -->
      2. Review Debug Logs: Monitor wp-content/.wpstaq/wpstaq.debug.log for cache deletion messages, such as:0b36f2ab [24-May-2024 13:13:09 UTC] WARNING: message='File /services expired 0.79h ago and deleted global:24h.'

    Note that logs auto-reset at 100 MB.

    Deprecating Files TTL Manager Feature

    In our pursuit of better management and optimization, we have deprecated the Files TTL Manager feature. Instead, users now have more streamlined options. They can set hourly TTL for specific pages either through custom plugin development or by utilizing our WP CLI command as a cron job, configurable directly from the Staq Panel:

    wp wpstaq clear-cache --post-id=<id1>,<id2>,...

    Need some help?

    We all do sometimes. Please reach out to our support team by dropping us a support ticket. We will respond fast.