<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] > [github](https://github.com/rfyiamcool/cronlib) ## 概述 Field name | Mandatory? | Allowed values | Allowed special characters ---------- | ---------- | -------------- | -------------------------- Seconds | Yes | 0-59 | * / , - Minutes | Yes | 0-59 | * / , - Hours | Yes | 0-23 | * / , - Day of month | Yes | 1-31 | * / , - ? Month | Yes | 1-12 or JAN-DEC | * / , - Day of week | Yes | 0-6 or SUN-SAT | * / , - ? ## 安裝 `go get github.com/rfyiamcool/cronlib` ## 實例 注意不要在 init中初始化 `cron = cronlib.New() ` ## 循環實例(注意避免注意指針影響) <details> <summary>main.go</summary> ``` package main import ( "fmt" "github.com/rfyiamcool/cronlib" ) var ( cron *cronlib.CronSchduler ) func main() { cron = cronlib.New() a := []struct { cron string name string url string }{ { name: "hello", cron: "*/1 * * * * *", url: "hello", }, { name: "word", cron: "*/2 * * * * *", url: "word", }, } for _, s := range a { b :=s model, e := cronlib.NewJobModel( b.cron, func() { fmt.Println(b.url) }) if e != nil { panic(e) } err := cron.Register(b.name, model) if err != nil { panic(err) } } cron.Start() select {} } ``` </details> <br/> ## 更新/停止操作 <details> <summary>描述</summary> ``` cron := cronlib.New() //添加定時器 model, _ := cronlib.NewJobModel("*/1 * * * * *", func() { fmt.Println("1") }) cron.Register("1",model) model2, _ := cronlib.NewJobModel("*/2 * * * * *", func() { fmt.Println("2") }) cron.Register("2",model2) // 停止定時 go func() { time.Sleep(4*time.Second) cron.StopService("1") }() // 取消注冊 go func() { time.Sleep(5*time.Second) cron.UnRegister("1") }() // 更新定時器 go func() { time.Sleep(5*time.Second) model2, _ := cronlib.NewJobModel("0 13 11 * * *", func() { fmt.Println("3") }) cron.UpdateJobModel("2",model2) }() //批量停止 prefix 的定時器 // cron.StopServicePrefix("web_") cron.Start() ``` </details> <br/>
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看