Skip to content

Commit

Permalink
update demo with interestedKeyPrefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodyiam committed Feb 16, 2019
1 parent 6a6f50b commit d1ae147
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,9 @@ public SpringBootApolloRefreshConfig(
this.refreshScope = refreshScope;
}

@ApolloConfigChangeListener({ConfigConsts.NAMESPACE_APPLICATION, "TEST1.apollo", "application.yaml"})
@ApolloConfigChangeListener(value = {ConfigConsts.NAMESPACE_APPLICATION, "TEST1.apollo", "application.yaml"},
interestedKeyPrefixes = {"redis.cache."})
public void onChange(ConfigChangeEvent changeEvent) {
boolean redisCacheKeysChanged = false;
for (String changedKey : changeEvent.changedKeys()) {
if (changedKey.startsWith("redis.cache")) {
redisCacheKeysChanged = true;
break;
}
}
if (!redisCacheKeysChanged) {
return;
}

logger.info("before refresh {}", sampleRedisConfig.toString());
refreshScope.refresh("sampleRedisConfig");
logger.info("after refresh {}", sampleRedisConfig.toString());
Expand Down

0 comments on commit d1ae147

Please sign in to comment.