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