modules/adpod.js
function firePrebidCacheCall(auctionInstance, bidList, afterBidAdded) {
  // remove entries now so other incoming bids won't accidentally have a stale version of the list while PBC is processing the current submitted list
  removeBidsFromStorage(bidList);

  store(bidList, function (error, cacheIds) {
    if (error) {
      utils.logWarn(`Failed to save to the video cache: ${error}. Video bid(s) must be discarded.`);
      for (let i = 0; i < bidList.length; i++) {
        doCallbacksIfTimedout(auctionInstance, bidList[i]);
      }
    } else {
      for (let i = 0; i < cacheIds.length; i++) {
        // when uuid in response is empty string then the key already existed, so this bid wasn't cached
        if (cacheIds[i].uuid !== '') {
          addBidToAuction(auctionInstance, bidList[i]);
        } else {
          utils.logInfo(`Detected a bid was not cached because the custom key was already registered.  Attempted to use key: ${bidList[i].customCacheKey}. Bid was: `, bidList[i]);
        }
        afterBidAdded();
      }
    }
  });
}
function firePrebidCacheCall(auctionInstance, bidList, afterBidAdded) {
  // remove entries now so other incoming bids won't accidentally have a stale version of the list while PBC is processing the current submitted list
  removeBidsFromStorage(bidList);

  store(bidList, function (error, cacheIds) {
    if (error) {
      utils.logWarn(`Failed to save to the video cache: ${error}. Video bid(s) must be discarded.`);
      for (let i = 0; i < bidList.length; i++) {
        doCallbacksIfTimedout(auctionInstance, bidList[i]);
      }
    } else {
      for (let i = 0; i < cacheIds.length; i++) {
        // when uuid in response is empty string then the key already existed, so this bid wasn't cached
        if (cacheIds[i].uuid !== '') {
          addBidToAuction(auctionInstance, bidList[i]);
        } else {
          utils.logInfo(`Detected a bid was not cached because the custom key was already registered.  Attempted to use key: ${bidList[i].customCacheKey}. Bid was: `, bidList[i]);
        }
        afterBidAdded();
      }
    }
  });
}
function firePrebidCacheCall ( auctionInstance , bidList , afterBidAdded ) { // remove entries now so other incoming bids won't accidentally have a stale version of the list while PBC is processing the current submitted list removeBidsFromStorage ( bidList ) ; store ( bidList , function ( error , cacheIds ) { if ( error ) { utils . logWarn ( ` ${ error } ` ) ; for ( let i = 0 ; i < bidList . length ; i ++ ) { doCallbacksIfTimedout ( auctionInstance , bidList [ i ] ) ; } } else { for ( let i = 0 ; i < cacheIds . length ; i ++ ) { // when uuid in response is empty string then the key already existed, so this bid wasn't cached if ( cacheIds [ i ] . uuid !== '' ) { addBidToAuction ( auctionInstance , bidList [ i ] ) ; } else { utils . logInfo ( ` ${ bidList [ i ] . customCacheKey } ` , bidList [ i ] ) ; } afterBidAdded ( ) ; } } } ) ; }
This function will send a list of bids to Prebid Cache.  It also removes the same bids from the internal bidCacheRegistry
to maintain which bids are in queue.
If the bids are successfully cached, they will be added to the respective auction.
@param {*} auctionInstance running context of the auction
@param {Array[Object]} bidList list of bid objects that need to be sent to Prebid Cache
@param {Function} afterBidAdded callback function used when Prebid Cache responds
This function will send a list of bids to Prebid Cache . It also removes the same bids from the internal bidCacheRegistry to maintain which bids are in queue . If the bids are successfully cached they will be added to the respective auction .