code: function calculateTotalSize(mainDoc) {
    var digestsToSizes = {};
  
    // dedup by digest, since that's what Pouch does under the hood
    Object.keys(mainDoc._attachments).forEach(function (attName) {
      var att = mainDoc._attachments[attName];
      digestsToSizes[att.digest] = att.length;
    });
  
    var total = 0;
    Object.keys(digestsToSizes).forEach(function (digest) {
      total += digestsToSizes[digest];
    });
    return total;
  }
docs: Get the total size of the LRU cache, taking duplicate digests into account