This is Redis key like "product:1:list:somekey" I want to remove all keys under list key
I used
Redis::del('product:1');
function but it didn't work.
Redis::keys() method what you need
$keys = Redis::keys('product:1:list:*')
that will return array of keys for given pattern
after that you must prepend your global cache prefix
function addPrefix($keys)
{
if (!count($keys)) return;
$prefix = config("cache.prefix") . ":";
return array_map(function ($item) use ($prefix) {
return $prefix . $item;
}, $keys);
}
$prefixed_keys = addPrefix($keys);
Redis::del($prefixed_keys)