goo_cron

package
v1.1.157 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

定时任务

  • 阻塞模式
c := goo_cron.Default()

c.Second(func() {
    fmt.Println("--11---", time.Now().Format("15:04:05"))
    time.Sleep(3 * time.Second)
    fmt.Println("--12---", time.Now().Format("15:04:05"))
})
c.SecondX(3, func() {
    fmt.Println("--21---", time.Now().Format("15:04:05"))
    time.Sleep(2 * time.Second)
    fmt.Println("--22---", time.Now().Format("15:04:05"))
})

c.Run()
  • 非阻塞模式
c := goo_cron.Default()

c.Second(func() {
    fmt.Println("--11---", time.Now().Format("15:04:05"))
    time.Sleep(3 * time.Second)
    fmt.Println("--12---", time.Now().Format("15:04:05"))
})
c.SecondX(3, func() {
    fmt.Println("--21---", time.Now().Format("15:04:05"))
    time.Sleep(2 * time.Second)
    fmt.Println("--22---", time.Now().Format("15:04:05"))
})

c.Start()

<-goo_context.Cancel().Done()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default added in v1.1.157

func Default() *crontab

func New added in v1.1.157

func New(opts ...cron.Option) *crontab

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL