Adding durability to in-memory data structures

前端 未结 6 2213
离开以前
离开以前 2021-02-14 19:53

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:19

    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.

提交回复
热议问题