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.