M
M
Mikhail Smirnov2021-12-27 08:44:43
Laravel
Mikhail Smirnov, 2021-12-27 08:44:43

How to find list of keys in laravel 8 cache files?

Laravel 8
File cache

For example, I save data with keys
user_1
user_2
user_3, etc. to the cache.

There are a lot of users in the database

And I need to clear the entire cache for user_*

How can I do this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JhaoDa, 2021-12-27
@fortoster82

This is not possible with the file driver. The list of keys is not stored anywhere. Switch to drivers that support tagging.

D
Dmitry Kuznetsov, 2021-12-27
@dima9595

Use cache tags, then you can just clear the tag.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question