Caching
Caching HTTP content correctly can be harder than it should be. HARP's built-in cache layer works out of the box with no configuration, using conservative defaults to avoid surprises. Every aspect is customizable, so you can start immediately and tune it to your needs as you go.
Using HARP's built-in cache saves the time and resources you would otherwise spend building and maintaining your own caching solution.
Works out of the box
You get a reliable caching mechanism by default, with sensible cache-control handling and no configuration required.
The underlying logic is provided by the Hishel library, which interprets cache-control and other related
headers.
Standard-compliant
HTTP caching behavior is defined by the RFC-9111 standard, and HARP adheres to it. This keeps cache behavior predictable and compatible with other systems that follow the same specification.
Industry standard test suite
Cache behavior is benchmarked against the Tests for HTTP Caches suite, which aims for near browser-grade cache handling.
Customizable at will
HARP is plug and play by default, but it also gives you control over APIs that handle caching poorly. If a remote service does not follow HTTP, defines its own headers, or sends cache-control headers that cache uncacheable content, you can correct it.
[rules."*"."GET /v2/*"]
on_remote_response = """
response.headers["cache-control"] = "public, max-age=3600"
"""The rules engine is just Python, so anything you can express in code, HARP can run. Most caching rules are simple assignments and conditions.
