Quantcast
Channel: Active questions tagged retry-logic - Stack Overflow
Viewing all articles
Browse latest Browse all 950

AWS Elasticache: Lettuce client: Retry mechanism

$
0
0

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


Viewing all articles
Browse latest Browse all 950

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>