protected function generateCachePath(
        string $resourceId,
        string $disk,
        string $extension,
        int $width = 0,
        int $height = 0,
        $fit = null
    ): string {
        if ($this->isLocalOrPublic($disk)) {
            $folder = config('filesystems.disks.' . $disk . '.root') . '/cache/' . str_replace('-', '/', $resourceId);

            if (!is_dir($folder)) {
                mkdir($folder, 0755, true);
            }
        }

        $path = 'cache/' . str_replace('-', '/', $resourceId) . '/';

        $path .= $width . '_' . $height;

        if ($fit) {
            $path .= '_fit';
        }

        return $path . $extension;
    }