编程语言
首页 > 编程语言> > leveldb-api:WriteOption.java

leveldb-api:WriteOption.java

作者:互联网

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是否写同步,同步写是忙于异步写,但不会造成数据丢失,

异步写只有机器重启的情况下才会数据丢失,其他情况不会丢失

标签:leveldb,java,WriteOptions,api,sync,boolean,snapshot,return,public
来源: https://www.cnblogs.com/yunqihao/p/16493558.html