public Void setStr(String key,String value)throws Exception{ RetryTemplate retryTemplate=initRetryTemplate(); retryTemplate.execute(new RetryCallback<Void,Exception>() { int i = 0; // 重试操作 @Override public Void doWithRetry(RetryContext retryContext) throws Exception { log.info("retry count: {}", retryContext.getRetryCount()); stringRedisTemplate.opsForValue().set(key,value); // return len(i++); return null; } }); return null;}
原文地址:https://www.cnblogs.com/junglecat/p/10026406.html
时间: 2024-10-11 05:17:32