public function delete( $id = null, $attributes = array(), $search = false )
    {
        $filename = $this->properties['location']
                  . $this->generateIdentifier( $id, $attributes );

        $filesToDelete = array();
        if ( file_exists( $filename ) )
        {
            $filesToDelete[] = $filename;
        }
        else if ( $search === true )
        {
            $filesToDelete = $this->search( $id, $attributes );
        }

        $deletedIds = array();
        foreach ( $filesToDelete as $filename )
        {
            if ( unlink( $filename ) === false )
            {
                throw new ezcBaseFilePermissionException(
                    $filename,
                    ezcBaseFileException::WRITE,
                    'Could not unlink cache file.'
                );
            }
            $deleted      = $this->extractIdentifier( $filename );
            $deletedIds[] = $deleted['id'];
        }
        return $deletedIds;
    }