I am looking for days to understand the cache with postgressql Here is the POST class
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
}
Here is the code that I could not understand at all
@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));
}
});
}
Here is the full code : link
These codes are taken from High Performance in-memory computing with Apache Ignite book. thank you...