private function updateRecord(string $id, string $key, string $value) : bool
    {
        $query = sprintf(
            'UPDATE %s SET %s = ?, %s = CASE WHEN %s = ? THEN %s + 1 ELSE ? END WHERE %s = ? AND %s = ?',
            $this->options['table-name'],
            $this->options['value-column'],
            $this->options['last-access-column'],
            $this->options['last-access-column'],
            $this->options['last-access-column'],
            $this->options['id-column'],
            $this->options['key-column']
        );

        $statement = $this->pdo->prepare($query);
        $statement->execute([$value, $time = time(), $time, $id, $key]);

        return $statement->rowCount() !== 0;
    }
private function updateRecord(string $id, string $key, string $value) : bool
    {
        $query = sprintf(
            'UPDATE %s SET %s = ?, %s = CASE WHEN %s = ? THEN %s + 1 ELSE ? END WHERE %s = ? AND %s = ?',
            $this->options['table-name'],
            $this->options['value-column'],
            $this->options['last-access-column'],
            $this->options['last-access-column'],
            $this->options['last-access-column'],
            $this->options['id-column'],
            $this->options['key-column']
        );

        $statement = $this->pdo->prepare($query);
        $statement->execute([$value, $time = time(), $time, $id, $key]);

        return $statement->rowCount() !== 0;
    }
private function updateRecord ( string $ id , string $ key , string $ value ) : bool { $ query = sprintf ( 'UPDATE %s SET %s = ?, %s = CASE WHEN %s = ? THEN %s + 1 ELSE ? END WHERE %s = ? AND %s = ?' , $ this -> options [ 'table-name' ] , $ this -> options [ 'value-column' ] , $ this -> options [ 'last-access-column' ] , $ this -> options [ 'last-access-column' ] , $ this -> options [ 'last-access-column' ] , $ this -> options [ 'id-column' ] , $ this -> options [ 'key-column' ] ) ; $ statement = $ this -> pdo -> prepare ( $ query ) ; $ statement -> execute ( [ $ value , $ time = time ( ) , $ time , $ id , $ key ] ) ; return $ statement -> rowCount ( ) !== 0 ; }
Updates the record with the given id and key.

The CASE statement is here to ensure that if two updates occur within the same second,
the record will still be updated and the method will return true.

@param string $id
@param string $key
@param string $value

@return bool Whether the record exists and was updated.
Updates the record with the given id and key .