Much faster cache file updating/creation.

Now the SQLite transactions will not write to disc in a synchronous
manner. The downside is the possibility of data loss in the case of
power failure. The upside is that it is much faster. Also added a
mechanism to discover DB corruption and simply create a new cache DB in
that case.