Im using REDIS to cache in Quarkus Application but sometimes I got an error saying that "Client is closed" when I try to access key/values from it.
WARN [io.net.uti.con.AbstractEventExecutor] (vert.x-eventloop-thread-2) A task raised an exception. Task: io.vertx.core.http.impl.pool.Pool$$Lambda$1087/0x0000000801418c40@b245c25: java.lang.IllegalStateException: Client is closed
I have Injected redisClient in a singleton class and use it to get/create/delete cache.
My Redis class:
@Singletonpublic class Redis{ @Inject RedisClient redisClient; public String add(final String key, final String value) { return redisClient.set(Arrays.asList(key, value)).toString(); } public String get(final String key) { return redisClient.get(key).toString(); }}
To access those methods I have Injected this class:
class XPTO { ... @Inject Redis redis; ... public test() { String cache = redis.add("allRegisters2", "abc"); }
Note:
- My Redis is running in docker all the time and I can access it via Redis explorer from Intellij.
- Sometimes I can access but on the second attempt the client connection is shutdown.
Any idea what is happening or a clue of what is causing the problem?