Versions in this module Expand all Collapse all v0 v0.3.2 Jun 14, 2020 Changes in this version + const Delimiter + const ModeGRPC + const ModeHTTP + const ModeMux + func GenerateKey(pieces ...string) string + type PeriodType int + const Day + const Hour + const Minute + const Month + const Second + const Year + func PeriodBucketTypeToPeriodType(periodType psc.PeriodBucketType) (PeriodType, ie.ServerError) + func StringToPeriodType(periodType string) (PeriodType, ie.ServerError) + func (periodType PeriodType) ToFriendlyString() string + func (periodType PeriodType) ToPeroidBucketType() psc.PeriodBucketType + func (periodType PeriodType) ToString() string + func (periodType PeriodType) ToTimeFormat() string + type RedisLimiter struct + Client prd.Client + func NewRedisLimiterWithClient(client prd.Client) *RedisLimiter + func NewRedisLimiterWithURL(redisURL string) (*RedisLimiter, error) + func (limiter *RedisLimiter) CheckState(ctx context.Context, key string, limitIDs ...string) (*psc.StatesByKeysWithRequest, error) + func (limiter *RedisLimiter) CheckStates(ctx context.Context, limitIDsByKey map[string][]string) (*psc.StatesByKeysWithRequest, error) + func (limiter *RedisLimiter) FinishRequest(ctx context.Context, requestID string, resources map[string]int64) error + func (limiter *RedisLimiter) GetLimit(ctx context.Context, limitID string) (*psc.Limit, error) + func (limiter *RedisLimiter) GetLimits(ctx context.Context, limitIDs []string) ([]*psc.Limit, error) + func (limiter *RedisLimiter) GetLimitsAll(ctx context.Context) ([]*psc.Limit, error) + func (limiter *RedisLimiter) PeekState(ctx context.Context, key string, limitIDs ...string) (*psc.StatesByKeysWithRequest, error) + func (limiter *RedisLimiter) PeekStates(ctx context.Context, limitIDsByKey map[string][]string) (*psc.StatesByKeysWithRequest, error) + func (limiter *RedisLimiter) RemoveLimit(ctx context.Context, limitID string) error + func (limiter *RedisLimiter) RemoveLimits(ctx context.Context, limitIDs []string) error + func (limiter *RedisLimiter) RemoveLimitsAll(ctx context.Context) error + func (limiter *RedisLimiter) SetLimit(ctx context.Context, limit *psc.Limit) error + func (limiter *RedisLimiter) SetLimits(ctx context.Context, limits []*psc.Limit) error