code/libraries/joomlatools/library/template/engine/abstract.php
public function cache($name, $source)
    {
        if($this->_cache)
        {
            $path = $this->_cache_path;

            if(!is_dir($path) && (false === @mkdir($path, 0755, true) && !is_dir($path)))
            {
                if($this->isDebug()) {
                    throw new RuntimeException(sprintf('The template cache path "%s" does not exist', $path));
                } else {
                    return false;
                }
            }

            if(!is_writable($path))
            {
                if($this->isDebug()) {
                    throw new RuntimeException(sprintf('The template cache path "%s" is not writable', $path));
                } else {
                    return false;
                }
            }

            $hash = crc32($name.PHP_VERSION);
            $file = $path.'/template_'.$hash.'.php';

            if(@file_put_contents($file, $source) === false)
            {
                if($this->isDebug()) {
                    throw new RuntimeException(sprintf('The template cannot be cached in "%s"', $file));
                } else {
                    return false;
                }
            }

            //Override default permissions for cache files
            @chmod($file, 0666 & ~umask());

            return $file;
        }

        return false;
    }
public function cache($name, $source)
    {
        if($this->_cache)
        {
            $path = $this->_cache_path;

            if(!is_dir($path) && (false === @mkdir($path, 0755, true) && !is_dir($path)))
            {
                if($this->isDebug()) {
                    throw new RuntimeException(sprintf('The template cache path "%s" does not exist', $path));
                } else {
                    return false;
                }
            }

            if(!is_writable($path))
            {
                if($this->isDebug()) {
                    throw new RuntimeException(sprintf('The template cache path "%s" is not writable', $path));
                } else {
                    return false;
                }
            }

            $hash = crc32($name.PHP_VERSION);
            $file = $path.'/template_'.$hash.'.php';

            if(@file_put_contents($file, $source) === false)
            {
                if($this->isDebug()) {
                    throw new RuntimeException(sprintf('The template cannot be cached in "%s"', $file));
                } else {
                    return false;
                }
            }

            //Override default permissions for cache files
            @chmod($file, 0666 & ~umask());

            return $file;
        }

        return false;
    }
public function cache ( $ name , $ source ) { if ( $ this -> _cache ) { $ path = $ this -> _cache_path ; if ( ! is_dir ( $ path ) && ( false === @ mkdir ( $ path , 0755 , true ) && ! is_dir ( $ path ) ) ) { if ( $ this -> isDebug ( ) ) { throw new RuntimeException ( sprintf ( 'The template cache path "%s" does not exist' , $ path ) ) ; } else { return false ; } } if ( ! is_writable ( $ path ) ) { if ( $ this -> isDebug ( ) ) { throw new RuntimeException ( sprintf ( 'The template cache path "%s" is not writable' , $ path ) ) ; } else { return false ; } } $ hash = crc32 ( $ name . PHP_VERSION ) ; $ file = $ path . '/template_' . $ hash . '.php' ; if ( @ file_put_contents ( $ file , $ source ) === false ) { if ( $ this -> isDebug ( ) ) { throw new RuntimeException ( sprintf ( 'The template cannot be cached in "%s"' , $ file ) ) ; } else { return false ; } } //Override default permissions for cache files @ chmod ( $ file , 0666 & ~ umask ( ) ) ; return $ file ; } return false ; }
Cache the template source in a file

Write the template source to a file cache. Requires cache to be enabled. This method will throw exceptions if
caching fails and debug is enabled. If debug is disabled FALSE will be returned.

@param  string $name     The file name
@param  string $source   The template source
@throws \RuntimeException If the file path does not exist
@throws \RuntimeException If the file path is not writable
@throws \RuntimeException If template cannot be written to the cache
@return string|false The cached file path. FALSE if the file cannot be stored in the cache
Cache the template source in a file