Ticker

There are often cases where we want to repeatedly perform a certain task after a certain interval of time. In Golang, we achieve this with the help of tickers.

We can use them with goroutines as well so that we can run these tasks in the background of our app without interrupting the flow of the app.

The function we use in tickers is the NewTicker() function which takes time as an argument and we can supply seconds and even milliseconds in it.

ticker.go