in my JAVA program I scan folders every hour an check those for changes. If there’s a change I receive a unique number to identify this file. These data are stored in a field variable. So I need to store the data locally for the case of restart or crash.
My Datastructure:
Map<String, Long> currentFiles = new HashMap<String, Long>();
Map<String, Long> prevFiles = new HashMap<String, Long>();
Which backup should I use? The data should be save against modifications. The data aren’t confidential.
You can simply serialize and deserialize your datastructure, it certainly looks Serializable. Tip
Or if you prefer more robust solutions, you can create DB tables with simple DBs (outside the process of your app), so it can survive the crashes, and reload your datastructure. (For example some simple Java based DBs: JavaDB, h2, HSQLDB)