You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/06/14 06:35:04 UTC
[GitHub] [incubator-shenyu] yu199195 commented on a diff in pull request #3554: [type:refactor] refactor redis blocking get method
yu199195 commented on code in PR #3554:
URL: https://github.com/apache/incubator-shenyu/pull/3554#discussion_r896426393
##########
shenyu-plugin/shenyu-plugin-cache/shenyu-plugin-cache-redis/src/main/java/org/apache/shenyu/plugin/cache/redis/RedisCache.java:
##########
@@ -58,7 +63,17 @@ public boolean cacheData(final String key, final byte[] bytes, final long timeou
*/
@Override
public boolean isExist(final String key) {
- return Boolean.TRUE.equals(this.redisTemplate.hasKey(key).block());
+ CompletableFuture<Boolean> f = CompletableFuture.supplyAsync(() -> Mono.from(this.redisTemplate.hasKey(key)).block());
+ Boolean result = null;
+ try {
+ result = f.get(3, TimeUnit.SECONDS);
+ } catch (ExecutionException | TimeoutException | InterruptedException e) {
+ e.printStackTrace();
Review Comment:
not used e.printStackTrace();
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org