예제 #1
0
 /**
  * tests the value update tracing
  */
 public function testValueUpdateTracing()
 {
     $memoryManager = new DummyMemoryManager();
     $memObject = new 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);
 }
예제 #2
0
파일: Value.php 프로젝트: Baft/Zend-Form
 /**
  * ArrayAccess interface method
  * Unset character at $offset position
  *
  * @param integer $offset
  */
 public function offsetUnset($offset)
 {
     unset($this->value[$offset]);
     if ($this->trace) {
         $this->trace = false;
         $this->container->processUpdate();
     }
 }
예제 #3
0
 /**
  * Load value from swap file.
  *
  * @internal
  * @param \Zend\Memory\Container\Movable $container
  * @param int $id
  */
 public function load(Container\Movable $container, $id)
 {
     $value = $this->cache->getItem($this->managerId . $id);
     // Try to swap other objects if necessary
     // (do not include specified object into check)
     $this->memorySize += strlen($value);
     $this->_swapCheck();
     // Add loaded object 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;
     }
 }