tessl install tessl/pypi-hishel@0.1.0Persistent cache implementation for httpx and httpcore following RFC 9111 specification
Agent Success
Agent success rate when using this tile
74%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.48x
Baseline
Agent success rate without this tile
50%
Build an HTTP cache proxy that intelligently handles stale cached responses according to HTTP caching specifications. The proxy should support configurable staleness policies while respecting cache control directives that prohibit serving stale content.
Your implementation should provide a cache proxy that:
The cache proxy should determine whether to serve stale content based on:
When stale serving is enabled by configuration:
When stale serving is disabled by configuration:
Your implementation must recognize and enforce these directives that prohibit serving stale content:
no-cache: Requires revalidation before servingmust-revalidate: Requires revalidation when staleproxy-revalidate: Requires revalidation when stale (for shared caches)If any of these directives are present in a cached response's Cache-Control header, the cache must not serve the stale response without revalidation, regardless of the stale-serving configuration.
Track whether responses were served from cache by including metadata with each response.
Cache-Control: max-age=10 and the cache expires after 15 seconds @testCache-Control: max-age=10 and the cache expires after 15 seconds @testCache-Control: max-age=10, no-cache and the cache expires after 15 seconds @testCache-Control: max-age=10, must-revalidate and the cache expires after 15 seconds @testCache-Control: max-age=10, proxy-revalidate and the cache expires after 15 seconds @testtest_stale_cache.py containing all test casesProvides HTTP caching capabilities with RFC 9111 compliance, including stale response handling and cache control directive parsing.
Your implementation should demonstrate proper usage of cache configuration and policy mechanisms. The solution should be concise and leverage the caching library's built-in capabilities for staleness checking and directive handling.
@generates