import NginxLinkInstructions from "@/common/NginxLinkInstructions"; import Tooltip from "@/common/Tooltip"; import Badge from "@/components/Badge"; import Card, { CardContent, CardHeader } from "@/components/Card"; import Notice from "@/components/Notice"; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"; import ControlsGroup from "@/pages/settings/controls/ControlsGroup"; import { useSettingsStore } from "@/store/optionsStore"; import { useAppStore } from "@/store/store"; import { createInterpolateElement } from "@wordpress/element"; import { __ } from "@wordpress/i18n"; const AdvancedCache = () => { const { isToggleOn } = useSettingsStore(); const { validPro } = useAppStore(); const controls = [ { id: 'cf_fallback_cache_curl', type: 'toggle', label: __('Use cURL', 'wp-cloudflare-page-cache'), description: __('Use cURL instead of WordPress advanced-cache.php to generate the page cache. It can increase the time it takes to generate the Page cache but improves compatibility with other performance plugins.', 'wp-cloudflare-page-cache'), }, { id: 'cf_fallback_cache_ttl', type: 'number', min: 0, label: `${__('Cache Lifespan', 'wp-cloudflare-page-cache')} (${__('seconds', 'wp-cloudflare-page-cache')})`, description: __('Enter 0 for no expiration.', 'wp-cloudflare-page-cache'), hide: !isToggleOn('cf_fallback_cache'), }, { id: 'stale_while_revalidate', type: 'toggle', label: __('Enable stale-while-revalidate for HTML cache', 'wp-cloudflare-page-cache'), description: __('Serve stale HTML briefly while the cache is refreshed in the background.', 'wp-cloudflare-page-cache'), }, { id: 'stale_while_revalidate_ttl', type: 'number', min: 0, label: `${__('Stale window', 'wp-cloudflare-page-cache')} (${__('seconds', 'wp-cloudflare-page-cache')})`, description: __('How long an expired HTML page may still be served while a background refresh is triggered.', 'wp-cloudflare-page-cache'), hide: !isToggleOn('stale_while_revalidate'), }, { id: 'cf_fallback_cache_save_headers', type: 'toggle', label: __('Save response headers', 'wp-cloudflare-page-cache'), description: `${__('Save response headers together with HTML code.', 'wp-cloudflare-page-cache')} ${__('The following response header will never be saved:', 'wp-cloudflare-page-cache')}`, hide: !isToggleOn('cf_fallback_cache'), children:
cache-control, set-cookie, X-WP-CF-Super-Cache*}, { id: 'cf_fallback_cache_http_response_code', type: 'toggle', label: __('Don\'t cache 4xx / 5xx responses', 'wp-cloudflare-page-cache'), description: __('Exclude 4xx and 5xx HTTP error responses from being cached.', 'wp-cloudflare-page-cache'), hide: !isToggleOn('cf_fallback_cache'), }, { id: 'cf_fallback_cache_prevent_cache_urls_without_trailing_slash', type: 'toggle', label: __('Prevent caching URLs without a trailing slash (/)', 'wp-cloudflare-page-cache'), hide: !isToggleOn('cf_fallback_cache'), }, { id: 'cf_auto_purge_on_comments', type: 'toggle', label: __('Auto-Purge Cache on Comment Activity', 'wp-cloudflare-page-cache'), description: __('Automatically purge single post cache when a new comment is inserted into the database or when a comment is approved or deleted', 'wp-cloudflare-page-cache'), }, { id: 'cf_auto_purge_on_upgrader_process_complete', type: 'toggle', label: __('Auto-purge on Updates', 'wp-cloudflare-page-cache'), description: __('Automatically purge the cache when the plugin update process is complete', 'wp-cloudflare-page-cache'), }, { id: 'enable_nonce_refresh', type: 'toggle', label: __('Enable nonce refresh', 'wp-cloudflare-page-cache'), description: __('Keeps forms, login, and cart actions working on long-cached pages by refreshing expired security tokens.', 'wp-cloudflare-page-cache'), utmCampaign: 'enable-nonce-refresh', locked: !validPro, }, { id: 'cache_tags', type: 'toggle', label: __('Enable Cache Tags', 'wp-cloudflare-page-cache'), description: __('Tag cached responses so granular invalidations (a single post, an author, a taxonomy term) clear only what changed instead of the whole cache.', 'wp-cloudflare-page-cache'), utmCampaign: 'cache-tags', locked: !validPro, }, { id: 'cf_strip_cookies', type: 'toggle', label: __('Strip response cookies', 'wp-cloudflare-page-cache'), description: __('Cloudflare will not cache responses that contain cookies. Enable this option to strip cookies from cached responses. Disable it if you notice issues with login or dynamic content.', 'wp-cloudflare-page-cache'), }, { id: 'cf_cache_control_htaccess', type: 'toggle', label: __('Overwrite the cache-control header for WordPress\'s pages using web server rules', 'wp-cloudflare-page-cache'), description: (
is_404is_singleis_pageis_front_pageis_homeis_archiveis_tagis_categoryis_feedis_searchis_authoris_ampis_ajaxis_query_varis_wp_json_restCache-Control response header, activate this option.', 'wp-cloudflare-page-cache'),
{
code:
}
)
}
/>
,
strong:
}
)
}
/>