我正在寻找几天来了解使用 postgressql 的缓存 这是 POST 类
public class Post implements Serializable {
private static final long serialVersionUID = 0L;
private String id;
private String title;
private String description;
private LocalDate creationDate;
private String author;
// rest of the setter and getter are omitted
}
这是我根本无法理解的代码
@Override
public Post load(String key) throws CacheLoaderException {
Map<String, Object> inputParam = new HashMap<>();
inputParam.put("id", key);
return jdbcTemplate.queryForObject("SELECT * FROM POSTS WHERE id=?", inputParam, new RowMapper<Post>() {
@Override
//WHAT THE mapRow method does? Is there another way to do some thing?
public Post mapRow(ResultSet rs, int i) throws SQLException {
return new Post(rs.getString(1), rs.getString(2), rs.getString(3), rs.getDate(4), rs.getString(5));
}
});
}
这是完整的代码:链接
这些代码取自《使用 Apache Ignite 进行高性能内存计算》一书。谢谢你...