src/core/framework/core/3rdparty/ezcomponents/Cache/src/manager.php
public static function createCache( $id, $location = null, $storageClass, $options = array() )
    {
        // BC for missing location. The location should not be missing.
        if ( $location !== null )
        {
            // Unifiy file system locations
            if ( substr( $location, 0, 1 ) === '/' )
            {
                // If non-existent
                if ( ( $realLocation = realpath( $location ) ) === false )
                {
                    throw new ezcBaseFileNotFoundException(
                        $location,
                        'cache location',
                        'Does not exist or is no directory.'
                    );
                }
                $location = $realLocation;
            }

            // Sanity check double taken locations.
            foreach ( self::$configurations as $confId => $config )
            {
                if ( $config['location'] === $location )
                {
                    throw new ezcCacheUsedLocationException( $location, $confId );
                }
            }
        }

        // Sanity check storage class.
        if ( !ezcBaseFeatures::classExists( $storageClass ) || !is_subclass_of( $storageClass, 'ezcCacheStorage' ) )
        {
            throw new ezcCacheInvalidStorageClassException( $storageClass );
        }
        self::$configurations[$id] = array(
            'location' => $location,
            'class'    => $storageClass,
            'options'  => $options,
        );
    }
public static function createCache( $id, $location = null, $storageClass, $options = array() )
    {
        // BC for missing location. The location should not be missing.
        if ( $location !== null )
        {
            // Unifiy file system locations
            if ( substr( $location, 0, 1 ) === '/' )
            {
                // If non-existent
                if ( ( $realLocation = realpath( $location ) ) === false )
                {
                    throw new ezcBaseFileNotFoundException(
                        $location,
                        'cache location',
                        'Does not exist or is no directory.'
                    );
                }
                $location = $realLocation;
            }

            // Sanity check double taken locations.
            foreach ( self::$configurations as $confId => $config )
            {
                if ( $config['location'] === $location )
                {
                    throw new ezcCacheUsedLocationException( $location, $confId );
                }
            }
        }

        // Sanity check storage class.
        if ( !ezcBaseFeatures::classExists( $storageClass ) || !is_subclass_of( $storageClass, 'ezcCacheStorage' ) )
        {
            throw new ezcCacheInvalidStorageClassException( $storageClass );
        }
        self::$configurations[$id] = array(
            'location' => $location,
            'class'    => $storageClass,
            'options'  => $options,
        );
    }
public static function createCache ( $ id , $ location = null , $ storageClass , $ options = array ( ) ) { // BC for missing location. The location should not be missing. if ( $ location !== null ) { // Unifiy file system locations if ( substr ( $ location , 0 , 1 ) === '/' ) { // If non-existent if ( ( $ realLocation = realpath ( $ location ) ) === false ) { throw new ezcBaseFileNotFoundException ( $ location , 'cache location' , 'Does not exist or is no directory.' ) ; } $ location = $ realLocation ; } // Sanity check double taken locations. foreach ( self :: $ configurations as $ confId => $ config ) { if ( $ config [ 'location' ] === $ location ) { throw new ezcCacheUsedLocationException ( $ location , $ confId ) ; } } } // Sanity check storage class. if ( ! ezcBaseFeatures :: classExists ( $ storageClass ) || ! is_subclass_of ( $ storageClass , 'ezcCacheStorage' ) ) { throw new ezcCacheInvalidStorageClassException ( $ storageClass ) ; } self :: $ configurations [ $ id ] = array ( 'location' => $ location , 'class' => $ storageClass , 'options' => $ options , ) ; }
Creates a new cache in the manager.
This method is used to create a new cache inside the manager.
Each cache has a unique ID to access it during the application
runtime. Each location may only be used by 1 cache.

The $storageClass parameter must be a subclass of
{@link ezcCacheStorage} and tells the manager which object
will be used for the cache.

The $location parameter depends on the kind of {@link ezcCacheStorage}
used for the cache you create. Usually this is a directory on your
file system, but may also be e.g. a data source name, if you cache in
a database or similar. For memory-based storage ({@link ezcCacheStorageApcPlain}
or {@link ezcCacheStorageMemcachePlain}) it is null, but for
memory/file hybrid storage ({@link ezcCacheStorageFileApcArray}) it should
be an existing writeable path.

The $options array consists of several standard attributes and can
additionally contain options defined by the {@link ezcCacheStorage}
class. Standard options are:

<code>
array(
'ttl'   => 60*60*24,    // Time-to-life, default: 1 day
);
</code>

@param string $id                     ID of the cache to create.
@param string $location               Location to create the cache in. Null for
memory-based storage and an existing
writeable path for file or memory/file
storage.
@param string $storageClass           Subclass of {@link ezcCacheStorage}.
@param array(string=>string) $options Options for the cache.
@return void

@throws ezcBaseFileNotFoundException
If the given location does not exist or is not a
directory (thrown by sanity checks performed when storing the
configuration of a cache to ensure the latter calls to
{@link ezcCacheManager::getCache()} do not fail).
@throws ezcBaseFilePermissionException
If the given location is not read/writeable (thrown by sanity
checks performed when storing the configuration of a cache to
ensure the latter calls to {@link ezcCacheManager::getCache()}
do not fail).
@throws ezcCacheUsedLocationException
If the given location is already in use by another cache.
@throws ezcCacheInvalidStorageClassException
If the given storage class does not exist or is no subclass of
ezcCacheStorage.
Creates a new cache in the manager . This method is used to create a new cache inside the manager . Each cache has a unique ID to access it during the application runtime . Each location may only be used by 1 cache .