'Scan pattern redis keys in cakephp 3.x

I am working on a project in which I am using default redis configuration available in cakephp 3.x

https://book.cakephp.org/3/en/core-libraries/caching.html

I am trying to cache my listing page and filters using unique keys as following

$numberKeyRedis = 'number_listing_'.md5(JSON_encode($_REQUEST));

So it will always create unique key if there is some new request or else it will get key from cache.

Now the problem is I want to delete all the keys which are created if I add/edit values. But, I checked the document of cakephp 3.x there is no option to scan redis keys by pattern.

How do I do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source