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

Locked

Create locked memory objects using the createLocked([$data]) method of the memory manager:

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

"Locked" means that such objects are never swapped and unloaded from memory.

Locked objects provides the same interface as movable objects (Zend_Memory_Container_Interface). So locked object can be used in any place instead of movable objects.

It's useful if an application or developer can decide, that some objects should never be swapped, based on performance considerations.

Access to locked objects is faster, because the memory manager doesn't need to track changes for these objects.

The locked objects class (Zend_Memory_Container_Locked) guarantees virtually the same performance as working with a string variable. The overhead is a single dereference to get the class property.

Zend Framework