Add circuit breaker cache adapter#69
Conversation
Greptile SummaryThis PR introduces a
Confidence Score: 5/5Safe to merge; the adapter is well-tested, dependency placement and version constraints are correct, and telemetry propagation works as documented. All changes are additive and isolated to the new No files require special attention. Important Files Changed
Reviews (11): Last reviewed commit: "Use camel case telemetry test name" | Re-trigger Greptile |
e2f99b4 to
87f8790
Compare
87f8790 to
b0cc209
Compare
What
Adds first-class circuit breaker support for cache adapters:
Utopia\Cache\Adapter\CircuitBreaker, backed byutopia-php/circuit-breaker.TelemetryAwareadapter contract.Cache::setTelemetry()to adapters that implementTelemetryAware.Shardingtelemetry-aware and forwards telemetry to telemetry-aware children.CircuitBreakertelemetry-aware and forwards telemetry to both the breaker and any telemetry-aware inner adapter.utopia-php/circuit-breakerto runtimerequirebecause the new source adapter depends on it.>=8.2, matching the circuit breaker package.Why
Cloud currently needs a circuit breaker cache wrapper and telemetry must be attached after cache construction. Putting the wrapper and telemetry propagation contract in
utopia-php/cacheavoids duplicating this logic in application repositories and keeps propagation typed instead of relying onmethod_exists.Testing
./vendor/bin/phpunit tests/Cache/CircuitBreakerTest.php./vendor/bin/phpunit tests/Cache/TelemetryTest.phpphp -d memory_limit=512M ./vendor/bin/phpstan analyse --level max src testscomposer lintNote: plain
composer checkhit the local default 128 MB PHP memory limit, so PHPStan was rerun directly withmemory_limit=512M.