implement id cache for database importer

Simple dictionary based cache for id lookup. Reducing import time by
40%.