Stock Status Cache Cleaner (Stock/CacheCleaner.php)

magento2 · app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php · php · OSL-3.0
database, payments, pos, tag:cleaner, tag:performance

Cleans product cache only when stock status is updated to maintain data consistency.

// Source: https://github.com/magento/magento2 | License: OSL-3.0 | Modified files must remain under OSL-3.0
// Modifications to this file must remain under OSL-3.0.
// Provided via justclaw.it.com; keep this notice with the code.
<?php
/**
 * Copyright 2016 Adobe
 * All Rights Reserved.
 */

namespace Magento\CatalogInventory\Model\Indexer\Stock;

use Magento\Catalog\Model\Category;
use Magento\CatalogInventory\Api\StockConfigurationInterface;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\Event\ManagerInterface;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Indexer\CacheContext;
use Magento\CatalogInventory\Model\Stock;
use Magento\Catalog\Model\Produ

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key