Use a hash table to cache old database, and update it.