PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Theory of Operation

Zend_Memory component operates with the following concepts:

  • Memory manager

  • Memory container

  • Locked memory object

  • Movable memory object

Memory manager

The memory manager generates memory objects (locked or movable) by request of user application and returns them wrapped into a memory container object.

Memory container

The memory container has a virtual or actual value attribute of string type. This attribute contains the data value specified at memory object creation time.

You can operate with this value attribute as an object property:

<?php
$memObject 
$memoryManager->create($data);

echo 
$memObject->value;

$memObject->value $newValue;

$memObject->value[$index] = '_';

echo 
ord($memObject->value[$index1]);

$memObject->value substr($memObject->value$start$length);

Note

If you are using a PHP version earlier than 5.2, use the getRef() method instead of accessing the value property directly.

Locked memory

Locked memory objects are always stored in memory. Data stored in locked memory are never swapped to the cache backend.

Movable memory

Movable memory objects are transparently swapped and loaded to/from the cache backend by Zend_Memory when it's necessary.

The memory manager doesn't swap objects with size less than the specified minimum, due to performance considerations. See this section for more details.

Zend Framework