Create a constant for chainstate write period in WriteChainState
Add coinscache information to RPC

Makes it possible to measure and compare caching strategies.
Split CCoinsView::GetCoins into GetCoins and ModifyCoins

Make intention more clear:

- Call ModifyCoins if you intend to change the coins
- Call GetCoins to get a const reference to the coins

This can be used for dirty tracking later on.
Implement CCoinsViewCache::GetCoins with FetchCoins

Avoids duplicating logic.
Also move the function together with its other overload in the
implementation file.
Adds stats counting to CCoinsViewCache
Make CCoinsViewCache::FetchCoins return a pointer instead of an iterator

This makes it possible to use different data structures for different
parts of the cache.
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.
Report rcache and wcache size separately in RPC
Change WriteChainState to use cache flags

- Flush READ and WRITE caches if maximum size exceeded (`pcoinsTip->GetCacheSize() > nCoinCacheSize`)
- Flush WRITE cache periodically if !InitialBlockDownload()
Move entries from write to read cache on flush

There's a large chance that entries will be accessed again after
being written.
Cache negative hits
Change the read cache to a MRU cache
Update VerifyDB and WriteChainState to make use of LRU cleanup
Comment update for CCoinsViewCache::Flush and Cleanup