persist/test/tidy/main.go

29 lines
442 B
Go

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