Skip to content

Commit

Permalink
set_field cache fix
Browse files Browse the repository at this point in the history
  • Loading branch information
divi255 committed May 25, 2021
1 parent 8079546 commit bdb4db1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1527,14 +1527,18 @@ impl Database {
}
}
}
&field[pos+1..]
&field[pos + 1..]
}
None => field
None => field,
};
match data_ptr.as_object_mut() {
Some(o) => {
o.insert(fname.to_owned(), value);
self.key_set(key, key_data)?;
let oldval = o.get(fname);
if oldval.is_none() || oldval.unwrap() != &value || !self.write_modified_only {
o.insert(fname.to_owned(), value);
self.cache.pop(&fmt_key(key));
self.key_set(key, key_data)?;
}
Ok(())
}
None => Err(Error::new(ErrorKind::DataError, "field is not object")),
Expand Down

0 comments on commit bdb4db1

Please sign in to comment.