示例#1
0
 /**
  * @param array $keys
  *
  * @return bool
  */
 public function deleteTimestamps(array $keys)
 {
     return $this->writer->delete($keys);
 }
 /**
  * @param \Spryker\Zed\Collector\Business\Exporter\Writer\TouchUpdaterInterface $touchUpdater
  * @param \Spryker\Zed\Collector\Business\Exporter\Writer\WriterInterface $storeWriter
  * @param string $itemType
  *
  * @return int
  */
 public function deleteDataFromStore(TouchUpdaterInterface $touchUpdater, WriterInterface $storeWriter, $itemType)
 {
     $touchUpdaterSet = new TouchUpdaterSet(CollectorConfig::COLLECTOR_TOUCH_ID);
     $batchCount = 1;
     $offset = 0;
     $deletedCount = 0;
     while ($batchCount > 0) {
         $entityCollection = $this->getTouchCollectionToDelete($itemType, $offset);
         $batchCount = count($entityCollection);
         if ($batchCount > 0) {
             $deletedCount += $batchCount;
             $offset += $this->chunkSize;
             $keysToDelete = $this->getKeysToDeleteAndUpdateTouchUpdaterSet($entityCollection, $touchUpdater->getTouchKeyColumnName(), $touchUpdaterSet);
             if ($keysToDelete) {
                 $storeWriter->delete($keysToDelete);
             }
         }
     }
     return $deletedCount;
 }