Skip to content

Rename cacheKey option to key#3

Merged
ChiragAgg5k merged 1 commit into
mainfrom
feat/rename-key-and-telemetry
May 12, 2026
Merged

Rename cacheKey option to key#3
ChiragAgg5k merged 1 commit into
mainfrom
feat/rename-key-and-telemetry

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

What

Renames the shared-state constructor option from cacheKey to key.

This updates:

  • CircuitBreaker::__construct() named argument and internal property
  • cache field namespacing and telemetry circuit_breaker.name source
  • unit and e2e test usage
  • README examples and configuration list
  • telemetry demo request/config field names

Why

key is shorter and matches the cache PR usage while still describing the circuit breaker state namespace.

Testing

  • composer format
  • composer lint
  • composer test:unit
  • php -d memory_limit=512M vendor/bin/phpstan analyse

Note: plain composer check hit the local default 128 MB PHP memory limit, so PHPStan was rerun directly with memory_limit=512M.

@greptile-apps

greptile-apps Bot commented May 12, 2026

Copy link
Copy Markdown

Greptile Summary

This PR performs a mechanical rename of the cacheKey constructor parameter and internal property to key across the entire codebase, with no functional changes to circuit breaker behaviour.

  • CircuitBreaker::__construct() named argument, private property, cache field namespacing, and telemetry circuit_breaker.name attribute are all updated consistently.
  • All tests (unit and e2e), README examples, and telemetry demo files (PHP, HTML, JS) are updated in lockstep; the helper function cacheKey() in server.php is also opportunistically renamed to normalizeKey() for clarity.

Confidence Score: 5/5

Pure rename with no logic changes — safe to merge.

Every call site, test, doc example, and template that referenced cacheKey has been updated to key. The rename is complete and internally consistent across all nine changed files, with the existing test suite providing good coverage of the renamed parameter.

No files require special attention.

Important Files Changed

Filename Overview
src/CircuitBreaker/CircuitBreaker.php Renames private property $cacheKey to $key and updates all internal usages including cache field namespacing and telemetry attribute
examples/telemetry/server.php Renames array key and local variable from cacheKey to key; also renames helper function cacheKey() to normalizeKey() for clarity. Env var BREAKER_DEMO_CACHE_KEY intentionally left as-is for backward compatibility.
examples/telemetry/public/app.js Updates DOM element references and payload field from cacheKey/activeCacheKey to key/activeKey consistently
examples/telemetry/public/index.html Renames HTML element IDs activeCacheKey and cacheKey to activeKey and key to match updated JS selectors
tests/unit/CircuitBreakerTest.php Updates all named argument usages from cacheKey: to key: across unit tests
tests/e2e/RedisAdapterTest.php Updates named argument from cacheKey: to key: in shared-state e2e test
tests/e2e/SwooleTableAdapterTest.php Updates named argument from cacheKey: to key: in Swoole shared-state e2e test
README.md Updates all code examples and the constructor option table to use key instead of cacheKey
examples/telemetry/scenario.php Updates config array key and PHPDoc type annotation from cacheKey to key

Reviews (2): Last reviewed commit: "Rename cacheKey option to key" | Re-trigger Greptile

Comment thread examples/telemetry/public/index.html Outdated
@ChiragAgg5k ChiragAgg5k force-pushed the feat/rename-key-and-telemetry branch from e1ff51d to a084d62 Compare May 12, 2026 04:16
@ChiragAgg5k ChiragAgg5k merged commit 064243c into main May 12, 2026
6 checks passed
@ChiragAgg5k ChiragAgg5k deleted the feat/rename-key-and-telemetry branch May 12, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants