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,
        );
    }