or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/hishel@0.1.x
tile.json

tessl/pypi-hishel

tessl install tessl/pypi-hishel@0.1.0

Persistent 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%

task.mdevals/scenario-9/

HTTP API Cache Manager

Build a cache manager for an HTTP API client that needs different caching strategies for different types of requests.

Requirements

Your task is to implement a cache manager that configures HTTP caching with three distinct policies:

Public API Cache

Create a cache configuration for public API endpoints that:

  • Acts as a shared cache (suitable for CDN or proxy use)
  • Only caches GET and HEAD requests
  • Never serves stale responses without revalidation

Private User Cache

Create a cache configuration for user-specific endpoints that:

  • Acts as a private cache (suitable for single-user clients)
  • Caches GET, HEAD, and POST requests
  • Allows serving stale responses when the server is unavailable

Flexible Search Cache

Create a cache configuration for search endpoints that:

  • Acts as a private cache
  • Caches POST requests (search queries sent via POST)
  • Requires revalidation for stale content

Test Cases

  • Public cache rejects responses with Cache-Control: private @test
  • Private cache accepts responses with Cache-Control: private @test
  • Public cache only allows GET and HEAD methods @test
  • Private user cache allows POST method caching @test
  • Public cache does not serve stale responses @test
  • Private user cache serves stale responses when configured @test

Implementation

@generates

API

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.
    """
    pass

Dependencies { .dependencies }

hishel { .dependency }

Provides HTTP caching support with RFC 9111 compliance.