Log in
Model

CountryModelsCache

Magento\Customer\Model\Address\AbstractAddress\CountryModelsCache

What it does

This class provides a caching mechanism for Country models in Magento 2, storing them by key to avoid repeatedly loading the same country data.

Developers would use this when working with customer addresses to improve performance by reusing already-loaded country objects instead of fetching them from the database multiple times.

The cache automatically resets after each request to prevent memory issues.

Public Methods

  • _resetState()
  • add()
  • get()