Skip to main content
Version: 2023.2

Working With Runtime Cache

Pimcore heavily uses runtime cache to cache API results for performance reasons. However, it is very crucial to understand that how to deal with cached results so that correct data should utilized from the API. Let's take few examples to understand similar situations:

//Delete item from the list
$list = new \Pimcore\Model\DataObject\Myclassname\Listing;
$list = new \Pimcore\Model\Document\Listing;
$list = new \Pimcore\Model\Asset\Listing;
$list->current()->delete(); //delete current item from list

$list->load(); //call load again to reset the runtime cache

foreach ($list as $element) {

//using force param to load latest data from database
\Pimcore\Model\DataObject::getById(123) === \Pimcore\Model\DataObject::getById(123) => true

\Pimcore\Model\DataObject::getById(123) === \Pimcore\Model\DataObject::getById(123, ['force' => true]) => false