skillfed

acachecontrol

Cache-Control for aiohttp

acachecontrol v0.3.7 529.5K downloads/30d#6,160 on PyPI8
Permissive license Apache License 2.0 AGING released

What it is and what it does

acachecontrol brings HTTP caching semantics to aiohttp, the popular async HTTP client library for Python. It wraps aiohttp sessions and automatically caches responses according to Cache-Control headers, reducing redundant network requests for cacheable content. The library is modeled after the synchronous CacheControl library for requests, adapting its logic to async/await patterns.

The package provides AsyncCache (an in-memory cache with configurable eviction) and AsyncCacheControl (a context manager that intercepts aiohttp requests and responses). You can customize both the cache backend (by implementing OrderedDict-like methods) and the request context manager. It supports Python 3.6 through 3.10 and runs on CPython and PyPy, though the project is still early and carries known bugs.

Use it for:

  • Reduce API call volume in async web scrapers or data-collection tools by caching responses per Cache-Control directives.
  • Speed up microservices that make repeated calls to the same external APIs by avoiding network round-trips.
  • Build async clients for REST APIs where caching is beneficial but the default aiohttp session does not implement it.
  • Prototype or test async HTTP workflows without implementing custom caching logic.
  • Extend aiohttp with standards-compliant HTTP caching for compliance-sensitive applications.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Adds HTTP caching to aiohttp requests by respecting Cache-Control headers, allowing async applications to avoid redundant network calls for cacheable responses.

Yes, if you need HTTP caching in an aiohttp application and can tolerate a young, minimally-maintained library. The permissive Apache license, low install friction, and zero known vulnerabilities are in its favor. However, the aging maintenance status (200 days since last commit, 8 stars) and the author's own caveat that the library is 'still under development' with 'a lot of bugs' mean you should test thoroughly in your use case and be prepared to fork or patch if issues arise.

Install

acachecontrol on PyPI

pip

pip install acachecontrol

uv

uv add acachecontrol

poetry

poetry add acachecontrol

Installing acachecontrol

Before you install

Low friction: pure Python wheel with a single runtime dependency (aiohttp). Maintenance status is aging—last commit was 200 days ago and the repository has minimal stars (8)—so expect slower response to issues, though the package remains archived=false and actively released.

License in practice

Apache License 2.0 (permissive): you may use, modify, and distribute this package freely in commercial and open-source projects, with only the requirement to include a copy of the license and note any changes made.

Quickstart

import asyncio
from acachecontrol import AsyncCache, AsyncCacheControl

async def main():
    cache = AsyncCache()
    async with AsyncCacheControl(cache=cache) as cached_sess:
        async with cached_sess.get('http://example.com') as resp:
            text = await resp.text()
            print(text)

asyncio.run(main())

Requires Python 3.6 or later; aiohttp must be installed separately.

Verify before relying

  • Whether the library's stated 'under development' status and acknowledged bugs have been resolved since the last commit 200 days ago.
  • Real-world performance impact of caching on typical aiohttp workloads.
  • Compatibility with recent aiohttp versions beyond what the classifiers declare.

Package facts

License Apache License 2.0 (permissive)
Python support supports the current Python release (<4.0,>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — aiohttp
Maintenance aging — 200 days since the last release
Last repo commit
First released
Downloads 529,516/month — #6,160 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: acachecontrol-0.3.7-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules

Tags

aiohttp cachingasync http cache controlcache-control for aiohttphttp response caching asyncaiohttp request memoizationasync web client cachingaiohttp cache middleware
async-httpcachingaiohttp-plugin

More Python Modules packages