Skip to content
Hosting2 min read

What is caching?

Short answer

Caching is keeping a ready copy of data or a page so later requests can be served straight from it instead of rebuilding it from scratch. On websites, caching cuts load times and reduces work for the CPU and the database.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Cache layers
  2. Practical example: browser caching in .htaccess
  3. Common problems
  4. On ArabyHost

A typical WordPress page runs PHP code and dozens of database queries on every visit. With page caching the page is built once and then served as ready-made HTML to every visitor until its content changes, which brings TTFB down sharply.

Cache layers

Layer Where it runs What it stores
Browser cache Visitor’s device Images, CSS and JS, per the Cache-Control header
CDN Edge locations worldwide Static files, sometimes whole pages
Page cache The server Complete HTML pages, e.g. LSCache
Object cache Memory Database query results, e.g. Redis
Opcode cache PHP Compiled code, via OPcache

Each layer solves a different problem, and they can all work together.

Practical example: browser caching in .htaccess

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
</IfModule>

This block in .htaccess tells browsers to keep images for a year and CSS/JS for a month. When you change a CSS file, rename it or add a version such as style.css?v=2 so visitors download the new one.

Common problems

  • Changes don’t show up: purge the plugin cache and the CDN cache, and try a private browser window.
  • One user sees another user’s data: private pages were cached. Exclude cart, checkout and account pages on WooCommerce stores.
  • Two caching plugins at once: running more than one page-cache plugin causes conflicts and odd errors; pick one.
  • Stale cache after a migration: purge every layer after moving the site or changing its domain.

On ArabyHost

Our servers run LiteSpeed, and WordPress sites use the LiteSpeed Cache plugin, which caches pages inside the web server itself and excludes cart and checkout pages by default. For setup steps and other tweaks, see the WordPress speed guide.

FAQ

Does clearing the cache delete my site's data?

No. The cache is only a temporary copy; clearing it makes the site rebuild pages. The first request afterwards may be a little slower, then things return to normal.

What's the difference between browser cache and server cache?

The browser cache lives on each visitor's device and only helps that visitor on later visits. A server cache helps everyone, because it serves the ready page to all visitors.

When should I not cache?

Never cache pages that differ per user, such as the cart, checkout, dashboard or customer account, or any response containing private data.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.