---
title: "Tech Tip #47: Cache at every layer"
description: "Why send the same bytes a million times?"
url: https://greencode.ai/tech-tips/47-cache-at-every-layer/
---

# Tech Tip #47: Cache at every layer

**Why send the same bytes a million times?**

[Watch the video](https://media.greencode.ai/shorts/cache-at-every-layer-4bc893a3c320.mp4)

Video created by [explainapaper.com](https://explainapaper.com/?utm_source=greencode.ai&utm_medium=film&utm_campaign=made-by)

### The problem

Responses that rarely change are regenerated and re-sent on every request: no cache headers, no CDN, no application cache.

### The fix you can use today

- Set Cache-Control headers on static assets, with long lifetimes and versioned file names.
- Put a CDN in front of static content.
- Cache expensive query results in the application where they can go slightly stale.

GreenCode researchers list missing caches as an energy waste to fix.

### Tools that help

- [GreenCode Constitution skill](https://greencode-constitution.org/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode) (GreenCode researchers): open-source energy principles and a catalogue of 37 energy anti-patterns that an AI coding agent can follow to find and fix waste like this
- [WebPageTest](https://www.webpagetest.org/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): loads a real page and shows every request, its size and when it loaded

### How GreenCode helps

GreenCode helps tackle this by scoring a codebase against quality, security and green software patterns in one pass, so a missing cache comes out as a ranked defect alongside the bugs and security findings. [More on this](https://greencode.ai/feature/sustainability-led-code-quality-assessment/).

### Tags

#caching#cdn#web-performance

### Sources

- [GreenCode Constitution (Kapenekakis et al., GreenAI workshop, ECML PKDD 2026): missing caching layers in Tier 2](https://greencode.ai/publications/greencode-constitution-agent-principles-for-optimizing-code-and-llm-inference-en/)
- [GreenCode Constitution skill, energy anti-patterns: H8 single-layer caching: browser, CDN, application and database](https://greencode-constitution.org/skill.md?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)
- [Green Software Foundation, Green Software Patterns: Cache static data](https://github.com/Green-Software-Foundation/patterns/blob/main/docs/development/data-handling/cache-static-data.md?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)
- [HTTP Archive, Web Almanac 2024, Sustainability: caching (about a quarter of sites send no caching headers)](https://almanac.httparchive.org/en/2024/sustainability?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode)
- [W3C, Web Sustainability Guidelines: server-side and client-side caching, cache lifetimes](https://www.w3.org/TR/web-sustainability-guidelines/#caching-resources)

[All GreenCode Tech Tips](https://greencode.ai/tech-tips/)

#### Key Facts

- Tip **#47**
- For **Developers**
- Category **Web and front-end**
- Format **short video**
![GreenCode](https://greencode.ai/wp-content/uploads/2024/12/greencode-logo-website-small-colours-2.webp)

Want this checked on your own system? Talk to the GreenCode team.

[Get in touch](https://greencode.ai/contact/)
