Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Memory manager
This class encapsulates memory menagement operations, when PHP works in limited memory mode.
Zend_Cache_Backend_Interface $_backend = 'null'
Object storage backend
Zend_Memory_Container_Movable $_lastModified = 'null'
Last modified object
It's used to reduce number of calls necessary to trace objects' modifications Modification is not processed by memory manager until we do not switch to another object. So we have to trace only first object modification and do nothing for others
integer $_managerId = ''
Unique memory manager id
integer $_memoryLimit = '1'
Memory grow limit.
Default value is 2/3 of memory_limit php.ini variable Negative value means no limit
integer $_memorySize = '0'
Overall size of memory, used by values
integer $_minSize = '16384'
Minimum value size to be swapped.
Default value is 16K Negative value means that memory objects are never swapped
integer $_nextId = '0'
Id for next Zend_Memory object
array $_sizes = 'array'
List of object sizes.
This list is used to calculate modification of object sizes
array(
array $_tags = ''
Tags array, used by backend to categorize stored values
array $_unloadCandidates = 'array'
List of candidates to unload
It also represents objects access history. Last accessed objects are moved to the end of array
array(
__construct(
Zend_Cache_Backend $backend
=
null
)
:
Memory manager constructor
If backend is not specified, then memory objects are never swapped
__destruct(
)
:
Object destructor
Clean up backend storage
_commit(
)
:
Commit modified object and put it back to the loaded objects list
_create(
string $value, boolean $locked
)
:
Zend_Memory_Container_Interface
Create new Zend_Memory object
_generateMemManagerId(
)
:
This function is intended to generate unique id, used by memory manager
_swap(
Zend_Memory_Container_Movable $container, integer $id
)
:
Swap object data to disk Actualy swaps data or only unloads it from memory, if object is not changed since last swap
_swapCheck(
)
:
Check and swap objects if necessary
create(
string $value
)
:
Zend_Memory_Container_Interface
Create new Zend_Memory value container
createLocked(
string $value
)
:
Zend_Memory_Container_Interface
Create new Zend_Memory value container, which has value always locked in memory
getMemoryLimit(
)
:
integer
Get memory grow limit
getMinSize(
)
:
integer
Get minimum size of values, which may be swapped
load(
Zend_Memory_Container_Movable $container, integer $id
)
:
Load value from swap file.
processUpdate(
Zend_Memory_Container_Movable $container, integer $id
)
:
Process value update
setMemoryLimit(
integer $newLimit
)
:
Set memory grow limit
setMinSize(
integer $newSize
)
:
Set minimum size of values, which may be swapped
unlink(
$container, integer $id
)
:
Zend_Memory_Container
Unlink value container from memory manager
Used by Memory container destroy() method