Class RedisRateLimiter

    • Constructor Detail

      • RedisRateLimiter

        public RedisRateLimiter​(org.springframework.data.redis.core.ReactiveStringRedisTemplate redisTemplate,
                                org.springframework.data.redis.core.script.RedisScript<List<Long>> script,
                                ConfigurationService configurationService)
      • RedisRateLimiter

        public RedisRateLimiter​(int defaultReplenishRate,
                                int defaultBurstCapacity)
        This creates an instance with default static configuration, useful in Java DSL.
        Parameters:
        defaultReplenishRate - how many tokens per second in token-bucket algorithm.
        defaultBurstCapacity - how many tokens the bucket can hold in token-bucket algorithm.
      • RedisRateLimiter

        public RedisRateLimiter​(int defaultReplenishRate,
                                int defaultBurstCapacity,
                                int defaultRequestedTokens)
        This creates an instance with default static configuration, useful in Java DSL.
        Parameters:
        defaultReplenishRate - how many tokens per second in token-bucket algorithm.
        defaultBurstCapacity - how many tokens the bucket can hold in token-bucket algorithm.
        defaultRequestedTokens - how many tokens are requested per request.
    • Method Detail

      • isIncludeHeaders

        public boolean isIncludeHeaders()
      • setIncludeHeaders

        public void setIncludeHeaders​(boolean includeHeaders)
      • getRemainingHeader

        public String getRemainingHeader()
      • setRemainingHeader

        public void setRemainingHeader​(String remainingHeader)
      • getReplenishRateHeader

        public String getReplenishRateHeader()
      • setReplenishRateHeader

        public void setReplenishRateHeader​(String replenishRateHeader)
      • getBurstCapacityHeader

        public String getBurstCapacityHeader()
      • setBurstCapacityHeader

        public void setBurstCapacityHeader​(String burstCapacityHeader)
      • getRequestedTokensHeader

        public String getRequestedTokensHeader()
      • setRequestedTokensHeader

        public void setRequestedTokensHeader​(String requestedTokensHeader)
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext context)
                                   throws org.springframework.beans.BeansException
        Used when setting default configuration in constructor.
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
        Parameters:
        context - the ApplicationContext object to be used by this object
        Throws:
        org.springframework.beans.BeansException - if thrown by application context methods