Skip to content

[12.x] Fix: Support taggeable store flushed cache events #55157

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

Closed
wants to merge 3 commits into from

Conversation

erikn69
Copy link
Contributor

@erikn69 erikn69 commented Mar 24, 2025

Barryvdh\Debugbar\DataCollector\CacheCollector::onCacheEvent(): Argument #1 ($event) must be of type Illuminate\Cache\Events\CacheEvent, Illuminate\Cache\Events\CacheFlushed given, called in /var/www/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php on line 460

I think it would be more consistent if it extended from Illuminate\Cache\Events\CacheEvent, look laravel debugbar DataCollector/CacheCollector.php#L33


also there is a TaggeableStore (tags),
but it does not allow adding tags as an argument

$cache->tags(['my_tag'])->flush();

public function __construct($storeName, $key, array $tags = [])

/**
* Fire an event for this cache instance.
*
* @param \Illuminate\Cache\Events\CacheEvent $event
* @return void
*/
protected function event($event)
{
parent::event($event->setTags($this->tags->getNames()));
}


it seems I'll have to highlight the signature.

* @param \Illuminate\Cache\Events\CacheEvent $event

* @param \Illuminate\Cache\Events\CacheEvent $event

@erikn69
Copy link
Contributor Author

erikn69 commented Mar 24, 2025

Tested on barryvdh/laravel-debugbar
image

Closes #55101

@erikn69 erikn69 changed the title [12.x] Fix: Support taggeable cache events [12.x] Fix: Support taggeable store flushed cache events Mar 24, 2025
@taylorotwell
Copy link
Member

This doesn't feel correct. Maybe something needs to be fixed in the package?

@erikn69
Copy link
Contributor Author

erikn69 commented Mar 27, 2025

@taylorotwell maybe, but the main problem remains on laravel

on TaggableStore the flushed event is not firing
$cache->tags(['tag_key'])->flush(); // no event dispatched, also setTags problem

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.

4 participants