Skip to content

Commit

Permalink
update: wkcache 执行lua脚本捕获只读节点异常
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizzercn committed Sep 8, 2023
1 parent 40947b3 commit 8912fce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ private void delCache(String cacheName) {
for (JedisPool pool : jedisCluster.getClusterNodes().values()) {
try (Jedis jedis = pool.getResource()) {
jedis.eval(lua, 0, cacheName + ":*");
} catch (Exception e){
//只读节点可能报错,忽略之
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ private void delCache(String cacheName, String cacheKey) {
for (JedisPool pool : jedisCluster.getClusterNodes().values()) {
try (Jedis jedis = pool.getResource()) {
jedis.eval(lua, Collections.singletonList(cacheName), Collections.singletonList(cacheKey.substring(0, cacheKey.lastIndexOf("*"))));
} catch (Exception e){
//只读节点可能报错,忽略之
}
}
} else {
Expand All @@ -117,6 +119,8 @@ private void delCache(String cacheName, String cacheKey) {
for (JedisPool pool : jedisCluster.getClusterNodes().values()) {
try (Jedis jedis = pool.getResource()) {
jedis.eval(lua, 0, cacheName + ":" + cacheKey);
} catch (Exception e){
//只读节点可能报错,忽略之
}
}
} else {
Expand Down

0 comments on commit 8912fce

Please sign in to comment.