Persistent cache implementation for httpx and httpcore following RFC 9111 specification
74
Build a cache manager for an HTTP API client that needs different caching strategies for different types of requests.
Your task is to implement a cache manager that configures HTTP caching with three distinct policies:
Create a cache configuration for public API endpoints that:
Create a cache configuration for user-specific endpoints that:
Create a cache configuration for search endpoints that:
Cache-Control: private @testCache-Control: private @test@generates
def create_public_cache():
"""
Creates a cache configuration for public API endpoints.
Returns:
A configured cache object suitable for shared caching that only
caches GET/HEAD requests and never serves stale content.
"""
pass
def create_private_user_cache():
"""
Creates a cache configuration for user-specific endpoints.
Returns:
A configured cache object suitable for private caching that caches
GET/HEAD/POST requests and allows serving stale content.
"""
pass
def create_search_cache():
"""
Creates a cache configuration for search endpoints.
Returns:
A configured cache object suitable for private caching of POST requests
that requires revalidation of stale content.
"""
passProvides HTTP caching support with RFC 9111 compliance.
Install with Tessl CLI
npx tessl i tessl/pypi-hisheldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10