TransWikia.com

Does a set in node.js reset if you restart a program?

Stack Overflow Asked by H Rashid on December 13, 2021

So I made a discord bot (this has nothing to do with the library), and was planning on implementing some Sets. What worried me was that every time the code is loaded, it sets the variable which my set is in to have no values. Does anyone know if this happens, and if it does, how to stop it from happening?

One Answer

When your program restarts, any memory the old program was keeping is freed and your code re-allocates everything from a clean slate (mostly).

What you need is persistence. This means storing data on disk. Generally, you'll want some kind of database, whether RDBMS or NoSQL, but I encourage you to explore other options as well - without knowing your use case there is not really a useful recommendation to make.

Answered by Klaycon on December 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP