-
-
Notifications
You must be signed in to change notification settings - Fork 11
Feature/Cache events #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/Cache events #221
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces a comprehensive event system for cache operations, enhancing observability and error handling by adding new event classes and updating existing ones to include the cache store name. It adds events for before/after operations (retrieving, writing, forgetting, flushing) and failure scenarios to improve cache activity tracking and diagnostics.
- Adds new event classes for cache operation states: RetrievingKey, WritingKey, ForgettingKey, CacheFlushing, plus failure events
- Updates existing events (CacheHit, CacheMissed, KeyWritten, KeyForgotten) to include store name parameter
- Modifies Repository and TaggedCache classes to dispatch events at appropriate operation points
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
tests/Cache/CacheEventsTest.php | Updates tests to expect new retrieving/writing/forgetting events alongside existing ones |
src/cache/src/TaggedCache.php | Adds cache flushing events around tag reset operations |
src/cache/src/Repository.php | Integrates comprehensive event dispatching throughout cache operations and adds store name support |
src/cache/src/Events/*.php | Creates new event classes and updates existing ones with store name parameter |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
public ?string $storeName; | ||
|
||
/** | ||
* The tags that were assigned to the key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions 'key' but this flush event doesn't have a key property. It should say 'The tags that were assigned to the cache.'
* The tags that were assigned to the key. | |
* The tags that were assigned to the cache. |
Copilot uses AI. Check for mistakes.
public ?string $storeName; | ||
|
||
/** | ||
* The tags that were assigned to the key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions 'key' but this flush event doesn't have a key property. It should say 'The tags that were assigned to the cache.'
* The tags that were assigned to the key. | |
* The tags that were assigned to the cache. |
Copilot uses AI. Check for mistakes.
public ?string $storeName; | ||
|
||
/** | ||
* The tags that were assigned to the key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions 'key' but this flush event doesn't have a key property. It should say 'The tags that were assigned to the cache.'
* The tags that were assigned to the key. | |
* The tags that were assigned to the cache. |
Copilot uses AI. Check for mistakes.
src/cache/src/Repository.php
Outdated
/** | ||
* Get the cache store name. | ||
*/ | ||
public function getName() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method is missing a return type declaration. It should specify : ?string
to match the usage patterns in the codebase.
public function getName() | |
public function getName(): ?string |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request introduces a comprehensive event system for cache operations, enhancing observability and error handling in the cache repository. It adds new event classes for various cache actions (including successful and failed operations), updates existing events to include the cache store name, and modifies the repository to dispatch these events at appropriate points. This makes it easier to track cache activity and diagnose issues.