Beispiel #1
0
func main() {
	fmt.Println("-----start sqlite go routines-----")
	engine, err := sqliteEngine()
	if err != nil {
		fmt.Println(err)
		return
	}
	engine.ShowSQL(true)
	cacher := xorm.NewLRUCacher2(xorm.NewMemoryStore(), time.Hour, 1000)
	engine.SetDefaultCacher(cacher)
	fmt.Println(engine)
	test(engine)
	fmt.Println("test end")
	engine.Close()

	fmt.Println("-----start mysql go routines-----")
	engine, err = mysqlEngine()
	engine.ShowSQL(true)
	cacher = xorm.NewLRUCacher2(xorm.NewMemoryStore(), time.Hour, 1000)
	engine.SetDefaultCacher(cacher)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer engine.Close()
	test(engine)
}
Beispiel #2
0
func newCache() core.Cacher {
	return xorm.NewLRUCacher2(xorm.NewMemoryStore(), time.Hour, 1000)
}