Class MemoryRatelimiter

java.lang.Object
com.mewna.catnip.shard.ratelimit.MemoryRatelimiter
All Implemented Interfaces:
Ratelimiter

public final class MemoryRatelimiter extends Object implements Ratelimiter
Since:
8/16/18.
Author:
amy
  • Constructor Details

    • MemoryRatelimiter

      public MemoryRatelimiter()
  • Method Details

    • checkRatelimit

      public org.apache.commons.lang3.tuple.ImmutablePair<Boolean,Long> checkRatelimit(String id, long periodMs, long limit)
      Description copied from interface: Ratelimiter
      Checks if the id is ratelimited, based on the period and the limit-per-period.
      Specified by:
      checkRatelimit in interface Ratelimiter
      Parameters:
      id - id to check
      periodMs - period of ratelimit reset
      limit - max "uses" before ratelimit for a given period is hit
      Returns:
      A (isRatelimited, amountRemaining) tuple