Skip to content

Commit

Permalink
HazelcastSpringBucket4jCacheConfiguration support for SyncCacheResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcGiffing authored Jun 2, 2024
1 parent 5a6982b commit f20a055
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.giffing.bucket4j.spring.boot.starter.config.cache.hazelcast.HazelcastReactiveBucket4jCacheConfiguration;
import com.giffing.bucket4j.spring.boot.starter.config.cache.hazelcast.HazelcastSpringBucket4jCacheConfiguration;
import com.giffing.bucket4j.spring.boot.starter.config.cache.ignite.IgniteBucket4jCacheConfiguration;
import com.giffing.bucket4j.spring.boot.starter.config.cache.infinispan.InfinispanBucket4jCacheConfiguration;
import com.giffing.bucket4j.spring.boot.starter.config.cache.jcache.InfinispanJCacheBucket4jConfiguration;
import com.giffing.bucket4j.spring.boot.starter.config.cache.jcache.JCacheBucket4jConfiguration;
Expand All @@ -26,6 +27,7 @@
JedisBucket4jConfiguration.class,
LettuceBucket4jConfiguration.class,
RedissonBucket4jConfiguration.class,
IgniteBucket4jCacheConfiguration.class
})
public class Bucket4jCacheConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.giffing.bucket4j.spring.boot.starter.config.cache.AbstractCacheResolverTemplate;
import com.giffing.bucket4j.spring.boot.starter.config.cache.AsyncCacheResolver;
import com.giffing.bucket4j.spring.boot.starter.config.cache.SyncCacheResolver;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import io.github.bucket4j.distributed.proxy.AbstractProxyManager;
Expand All @@ -14,7 +15,7 @@
* It uses the {@link HazelcastInstance} to retrieve the needed cache.
*
*/
public class HazelcastCacheResolver extends AbstractCacheResolverTemplate<String> implements AsyncCacheResolver {
public class HazelcastCacheResolver extends AbstractCacheResolverTemplate<String> implements SyncCacheResolver, AsyncCacheResolver {

private final HazelcastInstance hazelcastInstance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public HazelcastSpringBucket4jCacheConfiguration(HazelcastCacheManager hazelcast

@Bean
@ConditionalOnMissingBean(SyncCacheResolver.class)
public AsyncCacheResolver hazelcastCacheResolver() {
public SyncCacheResolver hazelcastCacheResolver() {
return new HazelcastCacheResolver(hazelcastInstance, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public String castStringToCacheKey(String key) {

@Override
public boolean isAsync() {
return false;
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@ConditionalOnSynchronousPropertyCondition
@ConditionalOnClass({CacheContainer.class, Caching.class, JCacheCacheManager.class})
@ConditionalOnBean(CacheContainer.class)
@ConditionalOnCache("jcache-ignite")
@ConditionalOnCache("jcache-infinispan")
public class InfinispanJCacheBucket4jConfiguration {

private final CacheContainer cacheContainer;
Expand Down

0 comments on commit f20a055

Please sign in to comment.