Skip to content

[11.x] Add Cache Flush Event #55148

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

Conversation

tech-wolf-tw
Copy link
Contributor

Description:
Introduces CacheFlushed event dispatching when calling $cache->flush(). Enables monitoring of full cache clearance for logging, auditing, or reactive workflows. Maintains backward compatibility.

This PR resolves this issue for Laravel Version 11

@erikn69
Copy link
Contributor

erikn69 commented Mar 24, 2025

CacheFlushFailed?

I also understand that it can be flushed using 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()));
}

So , wouldn't $event->setTags give an Exception?
I'm just concerned, I don't know if it works correctly in Tags

@taylorotwell
Copy link
Member

We aren't adding new features to 11.x after the release of 12.x. Only security fixes.

@tech-wolf-tw
Copy link
Contributor Author

CacheFlushFailed?

I also understand that it can be flushed using 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()));
}

So , wouldn't $event->setTags give an Exception?

I'm just concerned, I don't know if it works correctly in Tags

Hi, let me check and confirm thanks!

@erikn69
Copy link
Contributor

erikn69 commented Mar 24, 2025

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.

3 participants