Question: I build an API, which will send data to another API when has been collect 10 hashes. The client sends 1 hash per hour.

For example:

1. The client POST hash to API
2. API need to store it somewhere until the hashes number becomes to 10
3. When the number of hashes becomes 10 need to send data to another API and start from 0 again

My question related to the 2nd point. I can store the hashes in the array, the problem is that the data will be lost when the server will be shut down suddenly.

This is the only data which I need to store in API, so I don't want to use DBS.

By the way, it's my first time of developing API, so will be glad to your help.

Thanks in advance.

Answer: 
Sorry but your only options of storing data are either **memory** or **disk**.

If you store data in variables, you're using **memory**. It is fast and instant but it's not durable as you already said.

If you store data in database, you're using disk **storage**. It is slower but it is durable.

If you need durability, then **database** is your only option. Or maybe if you don't want to store the data in your machine, you could use cloud database such as firebase database.
Maybe your problem will be solved with [Redis](https://redis.io/).

I had one feature where I needed to use some user's pieces of information on the server side in runtime and it could not be persisted at the database.

So, I used [this](https://www.npmjs.com/package/express-redis-cache).

In simple words, the redis will save the information in your cache and you can retrieve when you need.

There's no disk use and are more stable than a hand made memory control.

I hope this helps you.