code: function(tile, tileUrl, existingRevision, done) {
  		if (!this.options.saveToCache) {
  			return;
  		}
  
  		var canvas = document.createElement("canvas");
  		canvas.width = tile.naturalWidth || tile.width;
  		canvas.height = tile.naturalHeight || tile.height;
  
  		var context = canvas.getContext("2d");
  		context.drawImage(tile, 0, 0);
  
  		var format = this.options.cacheFormat;
  
  		canvas.toBlob(
  			function(blob) {
  				this._db
  					.put({
  						_id: tileUrl,
  						_rev: existingRevision,
  						timestamp: Date.now(),
  					})
  					.then(
  						function(status) {
  							return this._db.putAttachment(
  								tileUrl,
  								"tile",
  								status.rev,
  								blob,
  								format
  							);
  						}.bind(this)
  					)
  					.then(function(resp) {
  						if (done) {
  							done();
  						}
  					})
  					.catch(function() {
  						// Saving the tile to the cache might have failed, 
  						// but the tile itself has been loaded.
  						if (done) {
  							done();
  						}
  					});
  			}.bind(this),
  			format
  		);
  	}
docs: Async'ly saves the tile as a PouchDB attachment Will run the done() callback (if any) when finished.