Class IRateLimiter.NoOpRateLimiter

java.lang.Object
io.github.devlibx.easy.ratelimit.IRateLimiter.NoOpRateLimiter
All Implemented Interfaces:
IRateLimiter
Enclosing interface:
IRateLimiter

public static class IRateLimiter.NoOpRateLimiter extends Object implements IRateLimiter
No op implementation
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.github.devlibx.easy.ratelimit.IRateLimiter

    IRateLimiter.NoOpRateLimiter
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Acquires a permit from this RateLimiter, blocking until one is available.
    void
    acquire(long permits)
    Acquires a specified permits from this RateLimiter, blocking until one is available.
    void
    Start rate limiter
    void
    Stop rate limiter
    boolean
    trySetRate(long rate)
    Initializes RateLimiter's state and stores config to Redis server.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.github.devlibx.easy.ratelimit.IRateLimiter

    debug
  • Constructor Details

    • NoOpRateLimiter

      public NoOpRateLimiter()
  • Method Details

    • start

      public void start()
      Description copied from interface: IRateLimiter
      Start rate limiter
      Specified by:
      start in interface IRateLimiter
    • stop

      public void stop()
      Description copied from interface: IRateLimiter
      Stop rate limiter
      Specified by:
      stop in interface IRateLimiter
    • trySetRate

      public boolean trySetRate(long rate)
      Description copied from interface: IRateLimiter
      Initializes RateLimiter's state and stores config to Redis server. Params: mode – - rate mode rate – - rate rateInterval – - rate time interval rateIntervalUnit – - rate time interval unit Returns: true if rate was set and false otherwise
      Specified by:
      trySetRate in interface IRateLimiter
    • acquire

      public void acquire()
      Description copied from interface: IRateLimiter
      Acquires a permit from this RateLimiter, blocking until one is available. Acquires a permit, if one is available and returns immediately, reducing the number of available permits by one.
      Specified by:
      acquire in interface IRateLimiter
    • acquire

      public void acquire(long permits)
      Description copied from interface: IRateLimiter
      Acquires a specified permits from this RateLimiter, blocking until one is available.

      Acquires the given number of permits, if they are available and returns immediately, reducing the number of available permits by the given amount.

      Specified by:
      acquire in interface IRateLimiter
      Parameters:
      permits - the number of permits to acquire