public static function loadBundle(&$bundle)
    {
        if (sizeof($bundle->content) == 0) {
            return;
        }
        
        // check for cached, preloaded bundle
        $bundleCache = Cache::getInstance('MEMCACHE', 'APC', 'FILE_ENCODED');
        $bundleCachePath = "xqbundle/{$bundle->bundleId}";
        
        if (!DEBUG && ($bundleCache->available() && $bundleCache->hasCached($bundleCachePath))) {
            $bundle = $bundleCache->getCached($bundleCachePath);
            return;
        }
        
        // preload
        $bundle->lastModified = null;
        $bundle->files = array();
        
        $fileNames = array();
        foreach ($bundle->content as $file) {
            $preloaded = self::getBundleFileDetails($bundle, $file);
            
            $bundle->files[] = $preloaded;
            $fileNames[] = $preloaded->path;
        }
        
        $bundle->contentType = self::getBundleContentType($bundle);
        $bundle->tag = md5($bundle->lastModified . $bundle->bundleId . implode('-', $fileNames));
        
        $bundle->output = self::getBundleContent($bundle);
        
        if (!DEBUG && $bundleCache->available()) {
            $bundleCache->cache($bundleCachePath, $bundle);
        }
    }