Skip to content

Namespace ApcuCache keys and scope clear() to the namespace#107

Merged
sascha-egerer merged 2 commits into
mainfrom
bugfix/apcu-cache-namespace
Jul 2, 2026
Merged

Namespace ApcuCache keys and scope clear() to the namespace#107
sascha-egerer merged 2 commits into
mainfrom
bugfix/apcu-cache-namespace

Conversation

@sascha-egerer

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the APCu-backed cache implementation to prefix all stored keys with a configurable namespace (default Phirewall:) and changes clear() to delete only keys within that namespace, avoiding wiping the entire shared APCu cache segment.

Changes:

  • Add a $namespace constructor argument to ApcuCache and prefix all APCu operations (including counter ::exp sidecar keys).
  • Scope ApcuCache::clear() to delete only the instance namespace via APCUIterator rather than calling apcu_clear_cache().
  • Add unit tests covering namespacing, namespace isolation, scoped clear(), and namespaced counter/TTL behavior; document behavior in the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/Store/ApcuCache.php Namespaces all stored APCu keys and scopes clear() to only delete matching namespace entries.
tests/Unit/Store/ApcuCacheTest.php Adds tests validating key namespacing, namespace isolation, scoped clearing, and namespaced counter sidecar keys.
CHANGELOG.md Documents the behavioral change and migration impact of APCu key namespacing and scoped clearing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Store/ApcuCache.php
Comment thread src/Store/ApcuCache.php
Comment thread tests/Unit/Store/ApcuCacheTest.php

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread src/Store/ApcuCache.php
@sascha-egerer sascha-egerer merged commit 808cd64 into main Jul 2, 2026
14 checks passed
@sascha-egerer sascha-egerer deleted the bugfix/apcu-cache-namespace branch July 2, 2026 12:58
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