package com.sf.vertx.handle;

import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.Handler;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;

/***
 * 限流熔断, redis存储
 * @author xy
 *
 */
@VertxGen
public interface RateLimitHandler extends Handler<RoutingContext> {
	
	static RateLimitHandler create(String instance) {
		switch (instance) {
		case "redis":
			RedisRateLimiter redisRateLimiter = new RedisRateLimiter();
			return new RateLimitHandlerRedisImpl(redisRateLimiter);
		default:
			// 本地缓存
			return null;
		}
		
	}	
}
