A
A
Anatoly2018-04-23 21:16:42
Laravel
Anatoly, 2018-04-23 21:16:42

How to clear cache files by mask?

Hi all.
Who can tell me if it is possible to clear the cache by mask in Laravel?
For example, I display a bunch of news and call the cache key based on the page number. But when more news is added, you need to clear the cache of all pages, because. news can go to other pages. Is it possible to somehow clear not the entire cache, but by mask, for example - it doesn’t work like that. Tell me, can there be a way not to write a search through the files? 'section_' . $request->input('page','1')
Cache::forget('section_*');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Evgrafovich, 2018-04-23
@Tantacula

https://laravel.com/docs/5.6/cache#cache-tags - but this won't work with the database driver. With him, only manually invent a mechanism.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question