protected function buildFileCache($type, $fileName)
    {
        if (!file_exists($fileName)) {
            return false;
        }
        
        // Load the content
        $content = $this->fileBackend->loadFromFile($fileName);
        
        // Optimze the content
        $content = $this->optimizeContent($type, $fileName, $content);
        
        // Minify the content, if possible and activated
        if (($type === AssetManager::CSS || $type === AssetManager::JS) && $this->minifyAssets) {
            $content = $this->minifyContent($type, $content);
        }
        
        // Generate the new file name
        $fileInfo = pathinfo($fileName);
        $hash = $this->getHash($fileName);
        $version = $fileInfo['filename'] . '-' . uniqid() . '.' . $fileInfo['extension'];
        $targetFile = $this->buildFilePath($type, $hash, $version);

        // Save the cached file
        $this->removeOldCacheFile($fileName);
        $this->fileBackend->saveToFile($content, $targetFile);

        // Save the cached files in the data array
        $this->cachedFiles[$hash] = array(
            'file' => $targetFile, 
            'checksum' => md5_file($fileName),
            'timestamp' => time()
        );
        $this->saveAssetsCache();
        
        return $targetFile;
    }