Can Netlify Functions share cache/memory?

Hey @franva! :wave:t2:

In general we need to think of each run of a Netlify Function (or any AWS Lambda function) as being completely stateless. This includes the in-memory data of the running Node.js process. We can put things in memory and read them out of memory freely but only within the context of that single run. So the saveSubscriptions() may work, but that memory will be erased quickly after that run is over.

AWS Lambda functions are made to not persist memory across runs.

If you need to store data and have it be accessible across different runs (or locations etc.) - you’ll need to use a third party data storage mechanism. Netlify does offer partner add-ons for sites though, and one of those is with FaunaDB - a third party data storage system that behaves similarly to a simple in-memory object cache.

https://docs.fauna.com/fauna/current/integrations/netlify.html

PS I did go ahead and change the category on this post to Support - This concern doesn’t pertain to Netlify CMS (a different product)

1 Like