leveldb/WriteOptions.java at master · dain/leveldb · GitHub
定义写操作方式
public class WriteOptions { private boolean sync; private boolean snapshot; public boolean sync() { return sync; } public WriteOptions sync(boolean sync) { this.sync = sync; return this; } public boolean snapshot() { return snapshot; } public WriteOptions snapshot(boolean snapshot) { this.snapshot = snapshot; return this; }
sync是否写同步,同步写是忙于异步写,但不会造成数据丢失,
异步写只有机器重启的情况下才会数据丢失,其他情况不会丢失
原创文章,作者:Carrie001128,如若转载,请注明出处:https://blog.ytso.com/275360.html