laravel指定某个redis连接库删除

protected function forgetByKey($prefix)
    {
        $redis = app('redis')->connection('cache');
        $keys = $redis->keys($prefix.'*');
        if (!empty($keys)) {
            foreach ($keys as $key) {
                $redis->del($key);
            }
        }
    }