yangys
2024-03-31 2969df3e404db3cd116f27db1495e523ce05bf86
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.qianwen.core.redis.ratelimiter;
 
import java.util.concurrent.TimeUnit;
 
/* loaded from: blade-starter-redis-9.3.0.0-SNAPSHOT.jar:org/springblade/core/redis/ratelimiter/RateLimiterException.class */
public class RateLimiterException extends RuntimeException {
    private final String key;
    private final long max;
    private final long ttl;
    private final TimeUnit timeUnit;
 
    public String getKey() {
        return this.key;
    }
 
    public long getMax() {
        return this.max;
    }
 
    public long getTtl() {
        return this.ttl;
    }
 
    public TimeUnit getTimeUnit() {
        return this.timeUnit;
    }
 
    public RateLimiterException(String key, long max, long ttl, TimeUnit timeUnit) {
        super(String.format("您的访问次数已超限:%s,速率:%d/%ds", key, Long.valueOf(max), Long.valueOf(timeUnit.toSeconds(ttl))));
        this.key = key;
        this.max = max;
        this.ttl = ttl;
        this.timeUnit = timeUnit;
    }
}