This is a Go library to increment a counter for a window of time (say last 60 second). Its resolution is 1 second.
Results will be periodically saved in a local file.
$ go get github.com/kavehmz/counter
# to test it as a http server you can do:
$ go run -race example/main.go
package main
import (
"fmt"
"github.com/kavehmz/counter"
)
func main() {
c := counter.Init("/tmp/counter", time.Second, 60)
ch := make(chan int)
c.Inc(ch)
fmt.Println(<-ch)
}
This lib is using and travesing a linked list to keep track of counts.