func (impl *SlidingWindowTpsLimitStrategy) IsAllowable() bool {
	impl.mutex.Lock()
	defer impl.mutex.Unlock()
	size := impl.queue.Len()
	current := time.Now().UnixNano()
	if size < impl.rate {
		impl.queue.PushBack(current)
		return true
	}
	boundary := current - impl.interval
	timestamp := impl.queue.Front()
	for timestamp != nil && timestamp.Value.(int64) < boundary {
		impl.queue.Remove(timestamp)
		timestamp = impl.queue.Front()
	}
	if impl.queue.Len() < impl.rate {
		impl.queue.PushBack(current)
		return true
	}
	return false
}
IsAllowable determines whether the number of requests within the time window overs the threshold
It is thread-safe.
package strategy
import (
	"container/list"
	"sync"
	"time"
)
import (
	"dubbo.apache.org/dubbo-go/v3/common/extension"
	"dubbo.apache.org/dubbo-go/v3/filter"
)
func init() {
	extension.SetTpsLimitStrategy("slidingWindow", &slidingWindowStrategyCreator{})
}
type SlidingWindowTpsLimitStrategy struct {
	rate     int
	interval int64
	mutex    *sync.Mutex
	queue    *list.List
}