Model

StockRegistryStorage

Magento\CatalogInventory\Model\StockRegistryStorage

What it does

This class acts as an in-memory cache storage for inventory-related data in Magento 2.

Developers use it to temporarily store and retrieve stock information, stock items, and stock statuses to avoid repeated database queries during a single request.

The cache is automatically cleared after each request through the ResetAfterRequestInterface implementation.

Public Methods

  • getStock()
  • setStock()
  • removeStock()
  • getStockItem()
  • setStockItem()
  • removeStockItem()
  • getStockStatus()
  • setStockStatus()
  • removeStockStatus()
  • clean()
  • _resetState()