Skip to content

Add HTTP Cache Override Support #54

@posborne

Description

@posborne

Overview

Add support for Fastly's HTTP Cache API, providing HTTP-aware caching with request/response handling and RFC 9111 compliance helpers.

WIT Interface

The WIT interface for http-cache is large, not included inline here.

API Design

  • Implement HttpCacheEntry resource wrapper for HTTP-aware cache operations
  • Provide HTTP Request/Response integration (wraps core cache with HTTP types)
  • Helper functions: is_request_cacheable(), suggested options generators
  • Support RFC 9111 compliance patterns
  • Cache override capabilities (TTL, stale-while-revalidate, surrogate keys)

Cross-SDK Comparison: Rust uses Request::set_cache_override() with enum variants (None/Pass/Override). Go and JS integrate cache override into request configuration. Python should provide similar enum-based API (CacheOverride.none(), .pass_(), .override(ttl=..., surrogate_key=...)).

Viceroy Testing

Viceroy's HTTP cache implementation follows similar limitations to Core Cache. Testing focus should be on:

  • Verifying cache override API calls work correctly
  • Testing SDK wrapper logic (option parsing, TTL handling, surrogate key formatting)
  • Ensuring HTTP cacheability checks function properly
  • Validating integration with Request/Response objects

Do NOT:

  • Try to verify actual cache behavior or persistence
  • Create elaborate tests around Viceroy's stubbed caching
  • Test cache hit/miss scenarios (this is host behavior, not SDK code)

The goal is to verify our Python wrapper code works, not to test Viceroy's cache implementation.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions