onCacheHit method

void onCacheHit(
  1. Hit hitToBeCached
)

Implementation

void onCacheHit(Hit hitToBeCached) {
  hitToBeCached.id =
      hitToBeCached.visitorId + "_" + FlagshipTools.generateUuidv4();
  if (hitToBeCached.type != HitCategory.CONSENT) {
    failedIds.add(hitToBeCached.id);
  }
  var bodyToCache = hitToBeCached.bodyTrack;
  if (hitToBeCached.createdAt != null) {
    bodyToCache.addEntries(
        {"createdAt": hitToBeCached.createdAt.toString()}.entries);
  }
  fsCacheHit?.cacheHits({hitToBeCached.id: bodyToCache});
}