Performance & Caching Best Practices #
PetMatchPro fetches animal data from external APIs, so caching plays an important role in page load speed. This guide covers how to optimize performance and work with common caching systems.
PetMatchPro API Caching #
Requires Junior license or higher.
PetMatchPro can cache API responses so it doesn’t call your partner’s API on every page load. Configure this in General Options:
- API Cache Enabled — Turn caching on/off
- Cache TTL (Time to Live) — How long cached data is valid before refreshing
Cached data is stored in PetMatchPro’s own database table, so it survives reliably for its full lifetime without depending on a persistent object cache (Redis/Memcached) or any paid host add-on.
As of version 8.16, the cache uses a two-stage lifetime built on top of the TTL you set:
- Fresh window — for the TTL you configure, visitors are served the cached copy instantly.
- Stale-while-revalidate — for a short window after the TTL expires, visitors still get an instant (slightly older) copy while the very next request quietly fetches fresh data in the background. This means a visitor almost never waits on a live API call just because the cache happened to expire.
If you ever need to bypass the cache for a single page load while testing, add ?pmp_nocache=1 to the page URL.
OPcache #
OPcache is a PHP bytecode cache that speeds up PHP execution. It’s enabled on most web servers by default.
The Issue #
When you update PetMatchPro settings or upload a new plugin version, OPcache may continue serving the old compiled PHP files. This means your changes don’t appear even though they’ve been saved.
How to Clear OPcache #
- cPanel: Look for “PHP Configuration” or “OPcache” in your hosting control panel
- Hosting dashboard: Many managed hosts have a “Clear Cache” button
- Contact your host: Ask them to clear OPcache or restart PHP-FPM
LiteSpeed Cache #
LiteSpeed is a web server used by many WordPress hosts. Its caching can be aggressive.
Recommended Settings #
- Exclude PetMatchPro pages from page cache — Search pages with filters and detail pages with dynamic content should not be fully cached
- Purge after updates — Purge the LiteSpeed cache after changing PetMatchPro settings
How to Purge #
- If using the LiteSpeed Cache WordPress plugin, go to LiteSpeed Cache > Toolbox > Purge All
- Or add your PetMatchPro pages to the “Do Not Cache” list in LiteSpeed settings
CDN Caching #
If you use a CDN (Cloudflare, StackPath, KeyCDN, etc.), it may cache your animal pages.
Recommended Configuration #
- Exclude dynamic PetMatchPro pages — Create a page rule or cache exception for your search and detail page URLs
- Allow CSS/JS caching — PetMatchPro’s static assets (stylesheets, scripts) can be safely cached
- Purge after updates — Clear the CDN cache when you update PetMatchPro or change settings
WordPress Object Cache #
PetMatchPro’s API cache lives in its own database table, so it does not require a persistent object cache (Redis, Memcached) to work, and flushing your object cache does not clear PetMatchPro’s cached API data. If you do run an object cache it can still speed up the rest of your site; to clear PetMatchPro’s API cache specifically, use Tools > Cache Management in the plugin.
Browser Caching #
Visitors’ browsers may cache PetMatchPro pages. If a visitor doesn’t see updated animals:
- Hard refresh the page: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Clear the browser cache
- Try an incognito/private browsing window
Performance Tips #
- Enable API caching (Junior+) to reduce API calls and speed up page loads
- Use result limits to avoid loading hundreds of animals at once
- Enable pagination to split large result sets across multiple pages
- Use the right template — simpler templates with fewer fields load faster
Next Steps #
- Stale Content / Cache Issues — When changes don’t appear
- API Connection Issues — Fix connection problems