I am using Lettuce (https://github.com/redis/lettuce) java client to read/write to AWS Elasticache. Below is the method to read from Cache by passing key.
public Object getJson(String key) { log.info("Reading from cache for key: {}", key); RedisAsyncCommands<String, String> async = null; try { async = redisCacheClient.connect().async(); return async.jsonGet(key, JsonPath.ROOT_PATH).get(); } catch (Exception e) { log.error("Exception while reading from Cache" + e.getLocalizedMessage()); return null; } finally { Objects.requireNonNull(async).quit(); } }
However, I want to implement a RETRY mechanism where if the first call to read from cache fails, I want to try one more time. Is there any Lettuce config available to achieve this ?
Thanks