28 lines
433 B
Go
28 lines
433 B
Go
|
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()
|
||
|
}
|
||
|
|