Accessing Infinispan with a Redis Client
What You Will Learn
How to use a standard Redis client (Jedis) to connect to Infinispan via the RESP (Redis Serialization Protocol) endpoint and perform basic set/get operations.
Prerequisites
-
Java 17+
-
An Infinispan Server running on
localhost:11222(or Docker/Podman available for Testcontainers)
Step 1: Add the Jedis Dependency
Add the Jedis Redis client to your pom.xml:
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${jedis.version}</version>
</dependency>
Step 2: Connect to Infinispan Using the Redis Protocol
Create a Jedis instance using a Redis URI with the Infinispan credentials:
String redisUri = String.format("redis://%s:%s@%s:%s",
TutorialsConnectorHelper.USER,
TutorialsConnectorHelper.PASSWORD,
TutorialsConnectorHelper.HOST,
port);
Jedis jedis = new Jedis(redisUri);
The tutorial automatically falls back to Testcontainers if no server is running locally.
Step 3: Perform Redis Operations
Use standard Redis commands to store and retrieve data from Infinispan:
String key = "Hello";
jedis.set(key, "world");
String value = jedis.get(key);
System.out.println(String.format("Read from Infinispan using a Redis Client (Resp Protocol): %s %s", key, value));
Step 4: Run the Tutorial
mvn package exec:java
You should see output like:
Read from Infinispan using a Redis Client (Resp Protocol): Hello world
What’s Next
-
Get started with the Hot Rod client
-
Use different encodings for your caches


