AtomCoder's avatar

Group Caching

Can't see any solid information on this, not even sure if it's available. I have an 'articles' page on my website with the content being changed or updated every 2 or 3 days.

I'm currently passing the page number from pagination and caching like so articles_page_1, articles_page_2 etc...... This works fine!

The problem is, when I update the content on the articles page I want to delete articles_page_1, articles_page_2 etc......which means having to find out how many pages are currently stored in cache and then delete them to update the new content.

Is there a way where I can create a cache group like Articles >> article_1, article_2 etc.... and then while updating or creating new content I just need to delete the Articles cache group to refresh the articles content?

Regards, AtomCoder

0 likes
4 replies
MortenS's avatar

You can use a cache tag for that, if you use a cache driver that supports them.

1 like
AtomCoder's avatar

I'm using file driver and only intend on using that.

MortenS's avatar

Then you'll need to call Cache::forget() on each individual cache key.

1 like

Please or to participate in this conversation.