Slide 7
Slide 7 text
Ondro Mihályi @OndroMih
Caching data in a function
static Map personCache
= new HashMap<>();
public APIGatewayProxyResponseEvent handleRequest(
APIGatewayProxyRequestEvent req, Context
context) {
String id = req.getQueryStringParameters().get("id");
Person p = personCache.get(id);
if (p == null) {
p = em.find(Person.class, id);
PersonCache.put(id, p);