Interface RestRateLimiter.GlobalRateLimit

Enclosing interface:
RestRateLimiter

public static interface RestRateLimiter.GlobalRateLimit
Global rate-limit store.
This can be used to share the global rate-limit information between multiple instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a default instance of this interface.
    long
    The current global rate-limit reset time.
    long
    The current cloudflare rate-limit reset time.
    void
    setClassic(long timestamp)
    Set the current global rate-limit reset time.
    void
    setCloudflare(long timestamp)
    Set the current cloudflare rate-limit reset time.
  • Method Details

    • getClassic

      long getClassic()
      The current global rate-limit reset time.
      This is the rate-limit applied on the bot token.
      Returns:
      The timestamp when the global rate-limit expires (unix timestamp in milliseconds)
    • setClassic

      void setClassic(long timestamp)
      Set the current global rate-limit reset time.
      This is the rate-limit applied on the bot token.
      Parameters:
      timestamp - The timestamp when the global rate-limit expires (unix timestamp in milliseconds)
    • getCloudflare

      long getCloudflare()
      The current cloudflare rate-limit reset time.
      This is the rate-limit applied on the current IP.
      Returns:
      The timestamp when the cloudflare rate-limit expires (unix timestamp in milliseconds)
    • setCloudflare

      void setCloudflare(long timestamp)
      Set the current cloudflare rate-limit reset time.
      This is the rate-limit applied on the current IP.
      Parameters:
      timestamp - The timestamp when the cloudflare rate-limit expires (unix timestamp in milliseconds)
    • create

      Creates a default instance of this interface.
      This uses AtomicLong to keep track of rate-limits.
      Returns:
      The default implementation