You can run a repeating timer that periodically saves the hash table to file. The frequency of the timer will depend on how often you change the contents of the file, and how worried you are about potentially losing a few entries in the table.

-genius_at_work