Skip to content

src/dazzle_back/runtime/api_cache.py

Generated: 2026-03-30T04:38:46.740528+00:00

Commit: 615f1354a103

Language: python

Scope: dazzle_back

Purpose

Async Redis cache for external API responses.

Provides cache-through with dedup locking for any external HTTP call site. Gracefully degrades to no-op when Redis is unavailable or disabled.

Cache key structure::

api_cache:{scope}:{url_hash}           → JSON response
api_cache:lock:{scope}:...

Key Exports

  • ApiResponseCache
  • available
  • get
  • put
  • acquire_lock
  • release_lock
  • close

Dependencies

Imports

  • hashlib
  • json
  • logging
  • os
  • typing.Any
  • redis.asyncio

Event Interactions

None detected.

Invariants and Assumptions

No invariants documented.

Tests

  • tests/unit/test_api_cache.py
  • tests/integration/test_runtime_e2e.py
  • tests/integration/test_runtime_pipeline.py
  • tests/unit/test_runtime_test_routes.py
  • tests/unit/test_runtime_services.py

Notes

This page was automatically generated by tools/gen_reference_docs.py.