Example #1
0
func main() {
	clear()
	env, _ = bdb.OpenEnv("../env", bdb.Create|bdb.InitMPool|bdb.InitLock|bdb.InitTxn)
	defer env.Close()
	db, _ = env.OpenDbFlags("db", bdb.BTree, bdb.Create|bdb.AutoCommit, bdb.Dup)
	defer db.Close()

	for i := 0; i < 10000; i++ {
		put()
		println("put")
		// time.Sleep(5 * 1e9)
	}
}
Example #2
0
func main() {
	go closer()

	var err os.Error
	env, err = bdb.OpenEnv("../env", bdb.Create|bdb.InitMPool|bdb.Thread)
	if err != nil {
		panic(err)
	}
	db, err = env.OpenDb("db", bdb.BTree, bdb.RdOnly|bdb.Thread)
	if err != nil {
		panic(err)
	}

	for i := 0; i < 1000; i++ {
		get()
		time.Sleep(1e8)
	}
}