Open
Add admin notification for Varnish purge object count#118
Conversation
- Created PurgeStatistics\Notification class to display purge information - Modified PurgeCache to capture and parse Varnish responses - Added parseVarnishResponse method to extract invalidated count from JSON - Added storePurgeStatistics method to save purge data via FlagManager - Registered new notification in adminhtml/di.xml Co-authored-by: peterjaap <431360+peterjaap@users.noreply.github.com>
- Changed PurgeStatistics\Notification to implement MessageInterface directly - Registered as separate notification in MessageList (not grouped with critical warnings) - Added proper getIdentity() implementation - Set severity to NOTICE for informational display Co-authored-by: peterjaap <431360+peterjaap@users.noreply.github.com>
- Use json_decode() instead of regex for parsing Varnish responses - Sum purged objects across servers instead of using max() - Import PurgeStatsNotification class instead of using FQN - Add caching to Notification::getStats() to avoid duplicate DB calls Co-authored-by: peterjaap <431360+peterjaap@users.noreply.github.com>
- Update return type documentation to clarify int|false return type - Improve getStats() clarity by using empty() instead of ternary operator Co-authored-by: peterjaap <431360+peterjaap@users.noreply.github.com>
- Remove unnecessary blank line in Notification class - Simplify isDisplayed() by removing redundant is_array check - Handle both \r\n and \n line endings in HTTP response parsing - Add is_array check before isset() for safer JSON parsing Co-authored-by: peterjaap <431360+peterjaap@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add admin notification for purged objects in Magento
Add admin notification for Varnish purge object count
Dec 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements admin notification displaying the number of objects purged from Varnish cache. Previously, purge operations provided no visibility into how many objects were invalidated.
Changes
New notification class (
Model/PurgeStatistics/Notification.php)MessageInterfacewith NOTICE severityEnhanced purge handling (
Model/PurgeCache.php){"invalidated": <count>}FlagManagerwith timestamp\r\nand\nline endingsConfiguration (
etc/adminhtml/di.xml)Example
When Varnish purges 2 objects using xkey:
The notification persists in admin until the next purge operation updates it.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.