added def get_dbid as well as supporting functions

Added cache as well to speed up the process of retrieving a dbid