io.github.bucket4j.grid.jcache.JCache Java Examples
The following examples show how to use
io.github.bucket4j.grid.jcache.JCache.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RateLimitingFilter.java From java-microservices-examples with Apache License 2.0 | 5 votes |
public RateLimitingFilter(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; CachingProvider cachingProvider = Caching.getCachingProvider(); CacheManager cacheManager = cachingProvider.getCacheManager(); CompleteConfiguration<String, GridBucketState> config = new MutableConfiguration<String, GridBucketState>() .setTypes(String.class, GridBucketState.class); this.cache = cacheManager.createCache(GATEWAY_RATE_LIMITING_CACHE_NAME, config); this.buckets = Bucket4j.extension(JCache.class).proxyManagerForCache(cache); }
Example #2
Source File: RateLimitingFilter.java From cubeai with Apache License 2.0 | 5 votes |
public RateLimitingFilter(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; CachingProvider cachingProvider = Caching.getCachingProvider(); CacheManager cacheManager = cachingProvider.getCacheManager(); CompleteConfiguration<String, GridBucketState> config = new MutableConfiguration<String, GridBucketState>() .setTypes(String.class, GridBucketState.class); this.cache = cacheManager.createCache(GATEWAY_RATE_LIMITING_CACHE_NAME, config); this.buckets = Bucket4j.extension(JCache.class).proxyManagerForCache(cache); }
Example #3
Source File: RateLimitingFilter.java From okta-jhipster-microservices-oauth-example with Apache License 2.0 | 5 votes |
public RateLimitingFilter(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; CachingProvider cachingProvider = Caching.getCachingProvider(); CacheManager cacheManager = cachingProvider.getCacheManager(); CompleteConfiguration<String, GridBucketState> config = new MutableConfiguration<String, GridBucketState>() .setTypes(String.class, GridBucketState.class); this.cache = cacheManager.createCache(GATEWAY_RATE_LIMITING_CACHE_NAME, config); this.buckets = Bucket4j.extension(JCache.class).proxyManagerForCache(cache); }
Example #4
Source File: RateLimitingFilter.java From e-commerce-microservice with Apache License 2.0 | 5 votes |
public RateLimitingFilter(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; CachingProvider cachingProvider = Caching.getCachingProvider(); CacheManager cacheManager = cachingProvider.getCacheManager(); CompleteConfiguration<String, GridBucketState> config = new MutableConfiguration<String, GridBucketState>() .setTypes(String.class, GridBucketState.class); this.cache = cacheManager.createCache(GATEWAY_RATE_LIMITING_CACHE_NAME, config); this.buckets = Bucket4j.extension(JCache.class).proxyManagerForCache(cache); }
Example #5
Source File: RateLimitingFilter.java From jhipster-microservices-example with Apache License 2.0 | 5 votes |
public RateLimitingFilter(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; CachingProvider cachingProvider = Caching.getCachingProvider(); CacheManager cacheManager = cachingProvider.getCacheManager(); CompleteConfiguration<String, GridBucketState> config = new MutableConfiguration<String, GridBucketState>() .setTypes(String.class, GridBucketState.class); this.cache = cacheManager.createCache(GATEWAY_RATE_LIMITING_CACHE_NAME, config); this.buckets = Bucket4j.extension(JCache.class).proxyManagerForCache(cache); }
Example #6
Source File: JCacheCacheResolver.java From bucket4j-spring-boot-starter with Apache License 2.0 | 5 votes |
public ProxyManager<String> resolve(String cacheName) { Cache springCache = cacheManager.getCache(cacheName); if (springCache == null) { throw new JCacheNotFoundException(cacheName); } return Bucket4j.extension(JCache.class).proxyManagerForCache(springCache); }
Example #7
Source File: RateLimitingFilter.java From tutorials with MIT License | 5 votes |
public RateLimitingFilter(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; CachingProvider cachingProvider = Caching.getCachingProvider(); CacheManager cacheManager = cachingProvider.getCacheManager(); CompleteConfiguration<String, GridBucketState> config = new MutableConfiguration<String, GridBucketState>() .setTypes(String.class, GridBucketState.class); this.cache = cacheManager.createCache(GATEWAY_RATE_LIMITING_CACHE_NAME, config); this.buckets = Bucket4j.extension(JCache.class).proxyManagerForCache(cache); }
Example #8
Source File: Bucket4jJCacheRateLimiter.java From spring-cloud-zuul-ratelimit with Apache License 2.0 | 4 votes |
public Bucket4jJCacheRateLimiter(final Cache<String, GridBucketState> cache) { super(io.github.bucket4j.grid.jcache.JCache.class); this.cache = cache; super.init(); }
Example #9
Source File: Bucket4jJCacheRateLimiter.java From spring-cloud-zuul-ratelimit with Apache License 2.0 | 4 votes |
@Override protected ProxyManager<String> getProxyManager(io.github.bucket4j.grid.jcache.JCache extension) { return extension.proxyManagerForCache(cache); }
Example #10
Source File: InfinispanJCacheTest.java From bucket4j with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void checkThatInfinispanProviderUnsupported() { Bucket4j.extension(JCache.class).builder(). addLimit(Bandwidth.simple(10, Duration.ofSeconds(60))). build(cache, "42", RecoveryStrategy.RECONSTRUCT); }