PHP code example of hirale / openmage-async-index
1. Go to this page and download the library: Download hirale/openmage-async-index library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hirale / openmage-async-index example snippets
#[\Maho\Config\Observer('hirale_asyncindex_reindex_after')] // Maho
public function purgeReindexed(Varien_Event_Observer $observer): void
{
$event = $observer->getEvent();
if ($event->getFull()) {
$this->purgeEverything();
return;
}
foreach ($event->getEntities() as $entity => $ids) {
// An empty list means every record of that entity.
$ids === [] ? $this->purgeEntity($entity) : $this->purgeIds($entity, $ids);
}
}
xml
<global>
<queue>
<routing>
<index_drain>fast</index_drain>
</routing>
</queue>
</global>