I have below code in AWS lambda:
const cache = {};
exports.handler = async (event) => {
// TODO implement
if (cache[event.key]) {
console.log('read from cache');
return cache[event.key];
}
console.log('generate value');
cache[event.key] = Math.random()
return cache[event.key];
};
when I run the the lambda and I can see read from cache on the log which means the lambda cache some values in cache memory. Does the lambda persist its memory when it becomes warm? Does it mean I can make use of this memory for some caching in order to improve performance?