public function store( $id, $data, $attributes = array() )
    {
        $filename = $this->properties['location']
                  . $this->generateIdentifier( $id, $attributes );
        if ( file_exists( $filename ) )
        {
            if ( unlink( $filename ) === false )
            {
                throw new ezcBaseFilePermissionException(
                    $filename,
                    ezcBaseFileException::WRITE,
                    'Could not delete existsing cache file.'
                );
            }
        }
        $dataStr = $this->prepareData( $data );
        $dirname = dirname( $filename );
        if ( !is_dir( $dirname ) && !mkdir( $dirname, 0777, true ) )
        {
            throw new ezcBaseFilePermissionException(
                $dirname,
                ezcBaseFileException::WRITE,
                'Could not create directory to stor cache file.'
            );
        }

        $this->storeRawData( $filename, $dataStr );

        if ( ezcBaseFeatures::os() !== "Windows" )
        {
            chmod( $filename, $this->options->permissions );
        }
        return $id;
    }
public function store( $id, $data, $attributes = array() )
    {
        $filename = $this->properties['location']
                  . $this->generateIdentifier( $id, $attributes );
        if ( file_exists( $filename ) )
        {
            if ( unlink( $filename ) === false )
            {
                throw new ezcBaseFilePermissionException(
                    $filename,
                    ezcBaseFileException::WRITE,
                    'Could not delete existsing cache file.'
                );
            }
        }
        $dataStr = $this->prepareData( $data );
        $dirname = dirname( $filename );
        if ( !is_dir( $dirname ) && !mkdir( $dirname, 0777, true ) )
        {
            throw new ezcBaseFilePermissionException(
                $dirname,
                ezcBaseFileException::WRITE,
                'Could not create directory to stor cache file.'
            );
        }

        $this->storeRawData( $filename, $dataStr );

        if ( ezcBaseFeatures::os() !== "Windows" )
        {
            chmod( $filename, $this->options->permissions );
        }
        return $id;
    }
public function store ( $ id , $ data , $ attributes = array ( ) ) { $ filename = $ this -> properties [ 'location' ] . $ this -> generateIdentifier ( $ id , $ attributes ) ; if ( file_exists ( $ filename ) ) { if ( unlink ( $ filename ) === false ) { throw new ezcBaseFilePermissionException ( $ filename , ezcBaseFileException :: WRITE , 'Could not delete existsing cache file.' ) ; } } $ dataStr = $ this -> prepareData ( $ data ) ; $ dirname = dirname ( $ filename ) ; if ( ! is_dir ( $ dirname ) && ! mkdir ( $ dirname , 0777 , true ) ) { throw new ezcBaseFilePermissionException ( $ dirname , ezcBaseFileException :: WRITE , 'Could not create directory to stor cache file.' ) ; } $ this -> storeRawData ( $ filename , $ dataStr ) ; if ( ezcBaseFeatures :: os ( ) !== "Windows" ) { chmod ( $ filename , $ this -> options -> permissions ) ; } return $ id ; }
Store data to the cache storage.
This method stores the given cache data into the cache, assigning the
ID given to it.

The type of cache data which is expected by a ezcCacheStorage depends on
its implementation. In most cases strings and arrays will be accepted,
in some rare cases only strings might be accepted.

Using attributes you can describe your cache data further. This allows
you to deal with multiple cache data at once later. Some ezcCacheStorage
implementations also use the attributes for storage purposes. Attributes
form some kind of "extended ID".

@param string $id                        Unique identifier for the data.
@param mixed $data                       The data to store.
@param array(string=>string) $attributes Attributes describing the
cached data.

@return string The ID string of the newly cached data.

@throws ezcBaseFilePermissionException
If an already existsing cache file could not be unlinked to
store the new data (may occur, when a cache item's TTL
has expired and the file should be stored with more actual
data). This exception means most likely that your cache directory
has been corrupted by external influences (file permission
change).
@throws ezcBaseFilePermissionException
If the directory to store the cache file could not be created.
This exception means most likely that your cache directory
has been corrupted by external influences (file permission
change).
@throws ezcBaseFileIoException
If an error occured while writing the data to the cache. If this
exception occurs, a serious error occured and your storage might
be corruped (e.g. broken network connection, file system broken,
...).
@throws ezcCacheInvalidDataException
If the data submitted can not be handled by the implementation
of {@link ezcCacheStorageFile}. Most implementations can not
handle objects and resources.
Store data to the cache storage . This method stores the given cache data into the cache assigning the ID given to it .