Cache
A cache is temporary storage that makes your online store faster by reusing information that has already been processed, instead of fetching and calculating it from scratch every time. It is essential for performance and user experience.
What is a cache?
A cache (pronounced "cash") is an intermediate store that keeps copies of data so they can be delivered faster the next time they are requested. When a visitor loads a page in your online store, the server normally has to fetch data from the database, process templates, generate HTML, and send it to the browser. With caching, the result is saved, so the next visit can be served directly without all that processing.
Caching happens at many levels, from the browser's local cache to server-side caching and CDN caching. Together, they can reduce load times dramatically.
Types of cache
Browser cache
The browser stores files such as images, CSS, JavaScript, and fonts locally on the user's device. The next time the user visits your store, these files are loaded from the local cache instead of being downloaded again. This is controlled with HTTP cache headers (Cache-Control, Expires, ETag).
Server-side cache
The server stores pre-generated pages or partial results, so they can be delivered without running the entire generation process for every request. This can be:
- Template cache: Compiled templates are reused instead of being parsed every time.
- Database cache: The results of frequent database queries are kept in memory.
- Object cache: Calculated objects (e.g., product data) are stored temporarily.
CDN cache
A Content Delivery Network (CDN) distributes copies of your static files to servers around the world. Users get the files from the nearest server, which reduces latency significantly.
Application cache
Caching at the application level with systems such as Redis or Memcached. Frequently used data is kept in the server's RAM for extremely fast access.
Caching in Shoporama
Shoporama uses several caching layers to optimize performance:
- Smarty template cache: Compiled templates are cached automatically and regenerated when the template changes.
- Feed cache: Product feeds (Google Shopping, PriceRunner, Kelkoo, and others) are cached for 1-6 hours to reduce server load.
- Sitemap cache: XML sitemaps are cached for 1 hour.
- Image cache: Generated thumbnails are cached, so they do not have to be resized every time they are displayed.
- Stock status cache: The stock status of products is cached for fast display.
Why is caching important?
- Faster loading: Cached pages load significantly faster, which gives a better user experience.
- Better SEO: Google uses Core Web Vitals (speed) as a ranking factor. Faster pages rank better.
- Lower server load: Caching reduces the number of database queries and calculations, which saves server resources.
- Better conversion: Studies show that a 1-second delay can reduce conversions by up to 7%.
Caching challenges
- Stale data: Cached data can show outdated prices, stock status, or content. Cache invalidation (clearing the cache when data changes) is one of the hardest problems in software development.
- Personalized content: Pages with personalized content (the cart, customer-specific prices) cannot be cached the same way as static pages.
- Debugging: Caching can make troubleshooting harder, because changes do not show up right away.
How to do it in Shoporama
Guides that show the term in practice
We know online marketing at Shoporama
We have worked with online marketing ourselves for decades. As the only e-commerce platform in Denmark, we have spoken several times at conferences such as Marketingcamp, SEOday, Shopcamp, Digital Marketing, E-commerce manageren, Ehandelsdagen, Web Analytics Wednesday, and many more.