Adding durability to in-memory data structures

前端 未结 6 1384
长情又很酷
长情又很酷 2021-02-14 20:13

What are some of the popular techniques you can adopt to add durability to your in-memory data structures (ie) if the process crashes, you can preserve all previously ex

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-14 20:43

    You could come up with some way to serialize your structure, whether with XML, YAML, JSON, etc. Then you could either store that in the DB, or perhaps put one big try/catch around the main execution point to the program. Then if some uncaught exception happens, which will cause the program to crash, you could serialize your data, ans well as log any error messages, stack traces, etc.

提交回复
热议问题