Cache node IDs in a hash table for faster lookups.