public void ForceCacheFlush(int flushCount) {
        // This is only forcing caches with pending updates to flush to DB. The
        //  ChunkCaches will remain intact.
        for (Map.Entry<String, ChunkCache> cursor : cachesByChunkId.entrySet()) {
            ChunkCache cache = cursor.getValue();
            if (cache.getTotalPendingCount() <= 0) {
                continue;
            }
            cache.flush();
            --flushCount;
            if (flushCount <= 0) {
                break;
            }
        }
    }