Skip to content

caibirdme/later

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Later

This library is an implementation of Hierarchical Timing Wheels. To learn more detailed information about it, see here.

Install

go get -u github.com/caibirdme/later

Quick Start

package main

import (
 "github.com/caibirdme/later"
 "time"
 "fmt"
)

func main() {
    timer := later.NewSecondTimeWheel()
    timer.Start() // start the timer

    timer.After(10*time.Second, func() {
        fmt.Println("print this 10s later")            
    })
    timer.Every(2*time.Second, func() {
        fmt.Println("print this every 2s")
    })
    // ...
    timer.Stop() // stop the timer
}

About

hierarchical timing wheels

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages