Closed zhoudingyun closed 3 years ago
version: 3.9.2
example one: public void main(RoutingContext routingContext) { vertx.sharedData().<String,String>getClusterWideMap("aa", asyncMapAsyncResult -> { if (asyncMapAsyncResult.succeeded()) { AsyncMap<String,String> a = asyncMapAsyncResult.result(); a.put("test", "test", 5000, voidAsyncResult -> { if (voidAsyncResult.succeeded()) { ResultUtils.success(routingContext, voidAsyncResult.result()); } else { ResultUtils.fail(routingContext, voidAsyncResult.cause()); } }); } }); }
example two: public void mysql(RoutingContext routingContext) { vertx.sharedData().<String,String>getClusterWideMap("aa", asyncMapAsyncResult -> { if (asyncMapAsyncResult.succeeded()) { AsyncMap<String,String> a = asyncMapAsyncResult.result(); a.get("test", voidAsyncResult -> { if (voidAsyncResult.succeeded()) { ResultUtils.success(routingContext, voidAsyncResult.result()); } else { ResultUtils.fail(routingContext, voidAsyncResult.cause()); } }); } }); }
Execute example one。 The cache will expire in 5000 seconds. But execute example one , then execute example two. The cache never expires. Why?
version: 3.9.2
example one: public void main(RoutingContext routingContext) { vertx.sharedData().<String,String>getClusterWideMap("aa", asyncMapAsyncResult -> { if (asyncMapAsyncResult.succeeded()) { AsyncMap<String,String> a = asyncMapAsyncResult.result(); a.put("test", "test", 5000, voidAsyncResult -> { if (voidAsyncResult.succeeded()) { ResultUtils.success(routingContext, voidAsyncResult.result()); } else { ResultUtils.fail(routingContext, voidAsyncResult.cause()); } }); } }); }
example two: public void mysql(RoutingContext routingContext) { vertx.sharedData().<String,String>getClusterWideMap("aa", asyncMapAsyncResult -> { if (asyncMapAsyncResult.succeeded()) { AsyncMap<String,String> a = asyncMapAsyncResult.result(); a.get("test", voidAsyncResult -> { if (voidAsyncResult.succeeded()) { ResultUtils.success(routingContext, voidAsyncResult.result()); } else { ResultUtils.fail(routingContext, voidAsyncResult.cause()); } }); } }); }
Execute example one。 The cache will expire in 5000 seconds. But execute example one , then execute example two. The cache never expires. Why?