Skip to content

Implement HTTP-layer cache for transport-level caching #23

@nicmostert

Description

@nicmostert

Overview

Implement the HTTP-layer cache for whurl. This layer intercepts GET/HEAD requests, uses HTTP caching headers (ETag, Last-Modified, Cache-Control) to serve fresh or revalidated responses, and minimizes redundant network requests.

Acceptance Criteria

  • Intercept all GET/HEAD requests via a transport/middleware.
  • Compute cache keys using method, URL, and Vary headers.
  • Store responses with status, headers, body, ETag, Last-Modified, and computed TTL (Cache-Control/Expires).
  • Prefer revalidation (If-None-Match/If-Modified-Since) over arbitrary TTL when possible.
  • Respect Cache-Control directives (no-store, no-cache, private), Vary, and common cacheable statuses (200, 301, 404).
  • Provide in-memory (LRU) backend, with optional disk persistence.
  • Expose configuration: cache size, default TTL, backend selection.
  • Implement explicit invalidation methods.
  • Document integration patterns and supported options.
  • Comprehensive tests for cache behavior, revalidation, and performance improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions