Skip to content

Commit

Permalink
fix: type check issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Roiocam committed Mar 22, 2024
1 parent 3ce4616 commit 62423d2
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
import com.alicp.jetcache.external.AbstractExternalCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Connection;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPooled;
import redis.clients.jedis.Pipeline;
import redis.clients.jedis.PipelineBase;
import redis.clients.jedis.Response;
import redis.clients.jedis.UnifiedJedis;
Expand Down Expand Up @@ -282,13 +280,14 @@ protected CacheResult do_PUT_ALL(Map<? extends K, ? extends V> map, long expireA
commands = (StringBinaryCommands) writeCommands();
int failCount = 0;
List<Response<String>> responses = new ArrayList<>();
if (commands instanceof JedisPooled) {
Connection connection = ((JedisPooled) commands).getPool().getResource();
pipeline = new Pipeline(connection);
if (commands instanceof Jedis) {
pipeline = ((Jedis) commands).pipelined();
} else if (commands instanceof JedisPooled) {
pipeline = ((JedisPooled) commands).pipelined();
} else if (commands instanceof JedisCluster) {
pipeline = ((JedisCluster) commands).pipelined();
} else {
pipeline = new Pipeline((Jedis) commands);
throw new IllegalArgumentException("unrecognized redis client type");
}
for (Map.Entry<? extends K, ? extends V> en : map.entrySet()) {
CacheValueHolder<V> holder = new CacheValueHolder(en.getValue(), timeUnit.toMillis(expireAfterWrite));
Expand Down

0 comments on commit 62423d2

Please sign in to comment.