Refactor the db util to allow caching of database misses

The intent of this is to make us able to immediately return
a NAK to the client if we know that there is no entry for a
given URL. That means caching those that we fail to find in the
database, until a reload of course. However, in order to do this
without prompting for the password each time, however, we need
to break up the creation of the object (and thus the cache)
from unlocking it after the timeout.
Cleanup imports on server.py
Allow setting option defaults in the config file