Skip to content
← Projects

Aiohttp-Cache

Python 44 stars 2024

Aiohttp-Cache is a cache for aiohttp servers. With it, my APIs went from 100 ms latency to 5 ms.

Why I built it

APIs keep doing the same thing over and over: database queries, calls to external services, all of it slow. The fix is a cache, but setting one up properly by hand is more of a hassle than it looks.

What it does

  • Caches HTTP responses automatically.
  • Works with Redis, Memcached or memory.
  • Invalidates the cache smartly.
  • TTLs are configurable.
  • Zero config by default.

Where I’ve used it

In APIs that dropped from 100 ms to 5 ms, a 95% improvement just by adding a cache. It has 44 stars and high-traffic APIs run it in production.

If you use aiohttp and want to go faster, give it a try.

Listen to the audio on why AI turns dumb

I send one email a day, and as soon as you sign up you get a ten minute audio on what almost nobody knows about ChatGPT and Claude.

Daniel Alfocea