This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
========================= | |
Setting bandwith to 5/min | |
Attempt to consume 5 | |
Attempt to consume 1 | |
Update configuration to 10/min using strategy PROPORTIONALLY | |
Sleeping 60+ seconds in order to refill all tokens | |
Attempt to consume 10 | |
Attempt to consume 1 | |
========================= | |
Setting bandwith to 5/min |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.Duration; | |
import io.github.bucket4j.Bucket; | |
import io.github.bucket4j.BucketConfiguration; | |
import io.github.bucket4j.TokensInheritanceStrategy; | |
public class LocalSnippet { | |
private void test() throws InterruptedException { | |
for (TokensInheritanceStrategy strategy : TokensInheritanceStrategy.values()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
========================= | |
Setting bandwith to 5/min | |
Attempt to consume 5 | |
Attempt to consume 1 | |
Update configuration to 10/min using strategy PROPORTIONALLY | |
Sleeping 60+ seconds in order to refill all tokens | |
Attempt to consume 10 | |
Attempt to consume 1 | |
========================= | |
Setting bandwith to 5/min |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.Duration; | |
import io.github.bucket4j.Bucket; | |
import io.github.bucket4j.BucketConfiguration; | |
import io.github.bucket4j.TokensInheritanceStrategy; | |
import io.github.bucket4j.redis.jedis.cas.JedisBasedProxyManager; | |
public class JedisSnippet { | |
private void test(JedisBasedProxyManager<byte[]> jedisBasedProxyManager) throws InterruptedException { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pre_clean() { | |
printf "\n##### RESETTING DOCKER VOLUME AND CONTAINER... #####\n" | |
docker stop mongotest | |
docker rm -v mongotest | |
sudo rm -rf /tmp/data | |
} | |
start_mongo() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Constructor; | |
import java.lang.reflect.Method; | |
import org.springframework.beans.BeansException; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.config.BeanPostProcessor; | |
import org.springframework.boot.web.servlet.error.ErrorController; | |
import org.springframework.cglib.proxy.Callback; | |
import org.springframework.cglib.proxy.CallbackFilter; | |
import org.springframework.cglib.proxy.Enhancer; |