/** * Load value from swap file. * * @internal * @param Zend_Memory_Container_Movable $container * @param integer $id */ public function load(Zend_Memory_Container_Movable $container, $id) { $value = $this->_backend->load($this->_managerId . $id, true); // Try to swap other objects if necessary // (do not include specified object into check) $this->_memorySize += strlen($value); $this->_swapCheck(); // Add loaded obect to the end of loaded objects list $container->setValue($value); if ($this->_sizes[$id] > $this->_minSize) { // Add object to the end of "unload candidates list" $this->_unloadCandidates[$id] = $container; } }
/** * tests the value update tracing */ public function testValueUpdateTracing() { if (version_compare(PHP_VERSION, '5.2') < 0) { // Skip next tests for PHP versions before 5.2 return; } $memoryManager = new Zend_Memory_Manager_Dummy(); $memObject = new Zend_Memory_Container_Movable($memoryManager, 10, '0123456789'); // startTrace() method is usually invoked by memory manager, when it need to be notified // about value update $memObject->startTrace(); $this->assertFalse($memoryManager->processUpdatePassed); $memObject->value[6] = '_'; $this->assertTrue($memoryManager->processUpdatePassed); $this->assertTrue($memoryManager->processedObject === $memObject); $this->assertEquals($memoryManager->processedId, 10); }