protected function cache_refresh(&$file, $clear = true, $folder = null)
    {
        // Add slash to end
        $folder = isset($folder) ? rtrim($folder, '/') . '/' : '';

        $path = $this->cache_path . $folder;

        // If module cache folder does not exists - create it
        if (!file_exists($path)) {
            mkdir($path, 0777, true);
        }

        // Build full path to cached file
        $file = $path . $file;

        // If cached file does not exsits
        if (!file_exists($file)) {
            // If clearence flag set to true - clear all files in module cache directory with same extension
            if ($clear) {
                File::clear($path, pathinfo($file, PATHINFO_EXTENSION));
            }

            // Signal for cache file regeneration
            return true;
        }

        return false;
    }