func NewRateRedisCounter(conn redis.Conn, prefix string, period time.Duration, resolution time.Duration) *RateRedisCounter {
	assertPeriodAndResolutionCorrect(period, resolution)

	return &RateRedisCounter{
		conn:         conn,
		period:       period,
		prefix:       prefix,
		resolution:   resolution,
		timer:        defaultTimer,
		bucketsCount: int(period / resolution),
	}
}
// NewRateRedisCounter initializes new Redis-based sharded counter
// prefix: a custom string prefix that will be added to the each bucket key
// period: defines the maximum period for which we count, e.g. 5m, 1h
// resolution: defines the resolution of a counter, i.e. the minimum time period of a counter bucket.
// counter value is calculated as a sum of all bucket values within the last period
NewRateRedisCounter initializes new Redis-based sharded counter
prefix: a custom string prefix that will be added to the each bucket key
period: defines the maximum period for which we count, e.g. 5m, 1h
resolution: defines the resolution of a counter, i.e. the minimum time period of a counter bucket.
counter value is calculated as a sum of all bucket values within the last period
// NewRateRedisCounter initializes new Redis - based sharded counter // prefix : a custom string prefix that will be added to the each bucket key // period : defines the maximum period for which we count e . g . 5m 1h // resolution : defines the resolution of a counter i . e . the minimum time period of a counter bucket . // counter value is calculated as a sum of all bucket values within the last period
func NewRateRedisCounter(conn redis.Conn, prefix string, period time.Duration, resolution time.Duration) *RateRedisCounter {
	assertPeriodAndResolutionCorrect(period, resolution)
	return &RateRedisCounter{
		conn:         conn,
		period:       period,
		prefix:       prefix,
		resolution:   resolution,
		timer:        defaultTimer,
		bucketsCount: int(period / resolution),
	}
}
func NewRateRedisCounter ( conn redis . Conn , prefix string , period time . Duration , resolution time . Duration ) * RateRedisCounter { assertPeriodAndResolutionCorrect ( period , resolution ) return & RateRedisCounter { conn : conn , period : period , prefix : prefix , resolution : resolution , timer : defaultTimer , bucketsCount : int ( period / resolution ) , } }
NewRateRedisCounter initializes new Redis-based sharded counter
prefix: a custom string prefix that will be added to the each bucket key
period: defines the maximum period for which we count, e.g.
NewRateRedisCounter initializes new Redis - based sharded counter prefix : a custom string prefix that will be added to the each bucket key period : defines the maximum period for which we count e . g .