I think to optimize flask app lambda server by adding internal cache for relatively slow to change data (e.g. site dropdowns might changes few times per year). I use zappa to deploy to lambda. Does it make any sense? Or does it flash memory each time a request processed. I know that I can not rely on aws preserving state, my goal here optimize performance a bit without spending a fortune on some redis instance not to mention ElastiCache.
UPDATE: Yup, the serverless deployment frameworks like zappa recycle the state, so why I should not. Below a hackernoon blog discuss the state recycling in greater details
https://hackernoon.com/write-recursive-aws-lambda-functions-the-right-way-4a4b5ae633b6
Whilst Lambda functions are ephemeral by design, containers are still reused for optimization which means you can still leverage in-memory states that are persisted through invocations.
Not sure can one invalidate such cache, env variables are likely local to lambda instance, http, sns probably difficult/expensive.