CCoinsViewCache: separate read and write caches

Keep track of entries that are read-only or r/w in separate caches. This is an optimization that avoids writing back all accessed entries back to the database on a flush.

Also makes the way clear for future optimizations such as putting a fixed limit on the size of the read cache, by using a different data structure for the read and write cache.

I've tested this with a full reindex on testnet and mainnet, as well as checkblocks. I wonder how it will fare under the pulltester.