Flush IMAP data to disk when stopping. Closes #5095.
Merge remote-tracking branch 'drebs/feature/in-memory-store-with-data-flushing' into develop
lock document retrieval/put
defer parse to thread
defer copy and soledad writes
prefetch flag docs
do not defer fetches to thread

I think this is not a good idea now that all is done in the memstore,
overhead from passing the data to thread and gathering the result
seems to be much higher than just retreiving the data we need from
the memstore.
temporarily nuke out the fetch_heders diversion
defend against empty items
take recent count from memstore
increase writeback period for debug
enable memory-only store
make last_uid a defaultdict
long-due update to unittests!

So we're safe under the green lights before further rewriting.
:)
change internal storage and keying scheme in memstore
make fdoc, hdoc, chash 'public' properties
remove hdoc copy since it's in its own structure now