samedi 23 mai 2020

Remove cache files in Laravel

I am beginner in Laravel.

I use in my project Laravel 7.

I have cache system in my project.

I have cache in my project with keys:

  • category
  • category.id
  • category.subcategory.id
  • product.all

etc.

I need function to remove cache.

I write this:

private function deleteCache(string $keyToRemove)
    {
        Cache::forget($keyToRemove);
    }

Is universal cache removal possible?

I need a function that will be

  1. Remove selected keys:

    deleteCache(['category.100', 'product.all', 'category.1'])

  2. Remove all cache with category (for example: category.1, category.all, category, category.tree, category.subcategory.1 etc).

    deleteCache(['category.*'])

How can I make it?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3gjtZiD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire