All Downloads are FREE. Search and download functionalities are using the official Maven repository.

es.moki.ratelimitj.inmemory.InMemoryRateLimiterFactory Maven / Gradle / Ivy

There is a newer version: 0.7.0
Show newest version
package es.moki.ratelimitj.inmemory;


import es.moki.ratelimitj.core.limiter.request.AbstractRequestRateLimiterFactory;
import es.moki.ratelimitj.core.limiter.request.AsyncRequestRateLimiter;
import es.moki.ratelimitj.core.limiter.request.ReactiveRequestRateLimiter;
import es.moki.ratelimitj.core.limiter.request.RequestLimitRule;
import es.moki.ratelimitj.core.limiter.request.RequestRateLimiter;
import es.moki.ratelimitj.inmemory.request.InMemorySlidingWindowRequestRateLimiter;

import java.io.IOException;
import java.util.Set;

public class InMemoryRateLimiterFactory extends AbstractRequestRateLimiterFactory {

    @Override
    public RequestRateLimiter getInstance(Set rules) {
        return lookupInstance(rules);
    }

    @Override
    public AsyncRequestRateLimiter getInstanceAsync(Set rules) {
        throw new RuntimeException("In memory async not yet implemented");
    }

    @Override
    public ReactiveRequestRateLimiter getInstanceReactive(Set rules) {
        throw new RuntimeException("In memory reactive not yet implemented");
    }

    @Override
    protected InMemorySlidingWindowRequestRateLimiter create(Set rules) {
        return new InMemorySlidingWindowRequestRateLimiter(rules);
    }

    @Override
    public void close() throws IOException {

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy