persist/test/tidy/main.go

28 lines
433 B
Go
Raw Normal View History

package main
import (
"fmt"
"time"
"gitlab.wow.st/gmp/persist"
)
func main() {
tc := persist.TidyConfig{
Interval: 2 * time.Second,
Func:persist.ExpireAfter(-5 * time.Second),
}
persist.Init(persist.Config{Tidy: tc})
x := persistInt("x",0)
persist.Commit()
x.Set(2)
persist.Commit()
x.Set(3)
persist.Commit()
fmt.Println(x.History())
time.Sleep(time.Second * 15)
fmt.Println(x.History())
persist.Shutdown()
}