在对缓存数据进行任何操作之后,我没有在所有实体的返回列表中得到实际值(方法getAllProxyConfigurations)。 为什么会发生这种情况以及如何解决?
@Cacheable("configuration")
public List<MySomeConfiguration> getAllProxyConfigurations() {
return repository.getAllConfigurations();
}
@Cacheable(value = "configuration", key = "#root.target.getConfigurationById(#id).serverId")
public MySomeConfiguration getConfigurationById(Long id) {
...
return configuration;
}
@CachePut(value = "configuration", key = "#configuration.serverId", condition = "#result.id != null")
public MySomeConfiguration addOrUpdateConfiguration(Configuration configuration) {
return configuration;
}
@Cacheable(value = "configuration", key = "#serverId")
public MySomeConfiguration getConfigurationByServerId(String serverId) {...
return configuration;
}
@CacheEvict(value = "configuration", key = "#root.target.getConfigurationById(#id).serverId")
public void deleteConfigurationById(Long id) {
...
}