Skip to content

Commit

Permalink
Minor refactoring to unify the names of the Redis cache implementations.
Browse files Browse the repository at this point in the history
  • Loading branch information
StFS committed Oct 3, 2023
1 parent 00c20fb commit f4c31b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* An implementation of the Redis device connection class using the Quarkus Redis client library.
*/
//@javax.enterprise.context.ApplicationScoped
public class RedisQuarkusCache implements Cache<String, String> {
private static final Logger LOG = LoggerFactory.getLogger(RedisCache.class);
public class QuarkusRedisCache implements Cache<String, String> {
private static final Logger LOG = LoggerFactory.getLogger(QuarkusRedisCache.class);

//private final RedisAPI redisApi;
private final ReactiveRedisDataSource reactiveRedisDataSource;
Expand All @@ -43,7 +43,7 @@ public class RedisQuarkusCache implements Cache<String, String> {
* TODO.
* @param reactiveRedisDataSource TODO
*/
public RedisQuarkusCache(final ReactiveRedisDataSource reactiveRedisDataSource) {
public QuarkusRedisCache(final ReactiveRedisDataSource reactiveRedisDataSource) {
//this.redisApi = redisApi;
this.reactiveRedisDataSource = reactiveRedisDataSource;
valueCommands = reactiveRedisDataSource.value(String.class, String.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
/**
* TODO.
*/
public class RedisCache implements Cache<String, String>, Lifecycle {
public class VertxRedisCache implements Cache<String, String>, Lifecycle {

private static final Logger LOG = LoggerFactory.getLogger(RedisCache.class);
private static final Logger LOG = LoggerFactory.getLogger(VertxRedisCache.class);

private static final int MAX_RECONNECT_RETRIES = 16;

Expand All @@ -61,7 +61,7 @@ public class RedisCache implements Cache<String, String>, Lifecycle {
* @param vertx TODO.
* @param properties TODO.
*/
private RedisCache(final Vertx vertx, final RedisRemoteConfigurationProperties properties) {
private VertxRedisCache(final Vertx vertx, final RedisRemoteConfigurationProperties properties) {

Objects.requireNonNull(vertx);
Objects.requireNonNull(properties);
Expand All @@ -83,13 +83,13 @@ private RedisCache(final Vertx vertx, final RedisRemoteConfigurationProperties p
*
* @return TODO.
*/
public static RedisCache from(
public static VertxRedisCache from(
final Vertx vertx, final RedisRemoteConfigurationProperties properties) {

Objects.requireNonNull(vertx);
Objects.requireNonNull(properties);

return new RedisCache(vertx, properties);
return new VertxRedisCache(vertx, properties);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
import org.eclipse.hono.deviceconnection.infinispan.client.HotrodCache;
import org.eclipse.hono.deviceconnection.infinispan.client.InfinispanRemoteConfigurationOptions;
import org.eclipse.hono.deviceconnection.infinispan.client.InfinispanRemoteConfigurationProperties;
import org.eclipse.hono.deviceconnection.redis.client.RedisCache;
import org.eclipse.hono.deviceconnection.redis.client.RedisQuarkusCache;
import org.eclipse.hono.deviceconnection.redis.client.QuarkusRedisCache;
import org.eclipse.hono.deviceconnection.redis.client.RedisRemoteConfigurationProperties;
import org.eclipse.hono.deviceconnection.redis.client.VertxRedisCache;
import org.eclipse.hono.util.Strings;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
Expand Down Expand Up @@ -93,13 +93,13 @@ Cache<String, String> cache(
final String cacheBackend = System.getProperty("cache.backend");
LOG.info("######################### Cache Backend: {}", cacheBackend);
if (true) {
return new RedisQuarkusCache(reactiveRedisDataSource);
return new QuarkusRedisCache(reactiveRedisDataSource);
}
if ("redis".equalsIgnoreCase(cacheBackend)) {
LOG.info("Creating a new REDIS cache.");
final var p = new RedisRemoteConfigurationProperties();
p.setConnectionString("redis://redis:6379");
return RedisCache.from(vertx, p);
return VertxRedisCache.from(vertx, p);
} else if (Strings.isNullOrEmpty(infinispanCacheConfig.getServerList())) {
LOG.info("configuring embedded cache");
return new EmbeddedCache<>(
Expand Down

0 comments on commit f4c31b6

Please sign in to comment.