Mobile cache
Keep a separate page cache for visitors on phones, for themes that show different pages on mobile devices.
Parts of this feature are still being built. The Not yet section lists them.
Mobile cache keeps a second copy of each cached page for visitors on mobile devices. Desktop visitors keep getting the normal cached page.
When you need it
Most themes send the same page to every device and change the layout with CSS. Those sites do not need mobile cache.
Turn it on when your theme or a plugin prints different HTML for phones, usually through WordPress's wp_is_mobile(). Without mobile cache, whichever device asks for a page first decides what every visitor gets until the cache expires.
Turn it on or off
- Open your site and go to Caching.
- On the Edge Caching tab, find Mobile cache and click Enable or Disable.
Avaloi applies the change on your site's server and at the edge, then clears your site's caches, so the next visitors may see slower pages for a moment. The change runs as a job you can follow in the jobs drawer. Changing mobile cache needs the permission to manage edge settings.
Who counts as mobile
Avaloi uses the same test as wp_is_mobile() in WordPress:
- A browser that sends the
Sec-CH-UA-Mobilehint is mobile when the hint says so, and desktop otherwise. - Otherwise the browser is mobile when its User-Agent contains
Mobile,Android,Silk/,Kindle,BlackBerry,Opera Mini, orOpera Mobi.
So an Android tablet counts as mobile, and an iPad that reports itself as desktop Safari counts as desktop, the same as WordPress decides.
Limits
- If your theme or a plugin changes
wp_is_mobile()with a filter, or detects devices its own way, the cache can still split pages differently from your theme. Test both a phone and a desktop after you turn it on. - Cloudflare's own cache by device type needs the Enterprise plan. Avaloi does not use it: the Avaloi edge cache keys mobile pages apart itself, so it works on every plan and uses none of the shared Cloudflare rule slots.
- Mobile pages are cached separately on the server. At the edge, Avaloi caches pages only through its edge cache, which keeps mobile pages apart too; Cloudflare never serves one device's page to the other.
- Clearing a URL clears both its desktop and mobile copies.
Not yet
- The Avaloi edge cache is not switched on for live traffic yet. Until it is, Cloudflare caches images, CSS, and JavaScript at the edge but no pages, so mobile cache works on your server's page cache only.
- A server whose agent is older than mobile cache keeps one shared page cache, and the job says the server needs an agent update.
API
PUT /v1/environments/{id}/tools/mobile-cachewith{"enabled": true}or{"enabled": false}. Answers 202 with the job.- The environment's
tool_settings.mobile_cacheshows the current setting. - MCP tool:
set_mobile_cache.
Related
Still stuck?
Email [email protected] with your site name and what you tried, or send us a message.