func (lim *Limiter) SetLimit(newLimit int64) {
	lim.mu.Lock()
	defer lim.mu.Unlock()
	lim.limit = newLimit
}
SetLimit sets a new Limit for the limiter.
package slidingwindow
import (
	"sync"
	"time"
)
type Window interface {
	Start() time.Time
	Count() int64
	AddCount(n int64)
	Reset(s time.Time, c int64)
	Sync(now time.Time)
}
type StopFunc func()
type NewWindow func() (Window, StopFunc)
type Limiter struct {
	size  time.Duration
	limit int64
	mu sync.Mutex
	curr Window
	prev Window
}
func NewLimiter(size time.Duration, limit int64, newWindow NewWindow) (*Limiter, StopFunc) {
	currWin, currStop := newWindow()
	prevWin, _ := NewLocalWindow()
	lim := &Limiter{
		size:  size,
		limit: limit,
		curr:  currWin,
		prev:  prevWin,
	}
	return lim, currStop
}
func (lim *Limiter) Size() time.Duration {
	return lim.size
}
func (lim *Limiter) Limit() int64 {
	lim.mu.Lock()
	defer lim.mu.Unlock()
	return lim.limit
}