Memory/Manager.php
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 [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Memory
- Version
- $Id: Manager.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Memory_Manager
Memory manager
This class encapsulates memory menagement operations, when PHP works in limited memory mode.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

\Zend_Memory_Container_Movable $_lastModified = nullLast 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
nullDetails

integer $_memoryLimit = -1Memory grow limit.
Default value is 2/3 of memory_limit php.ini variable Negative value means no limit
-1Details- Type
- integer

integer $_minSize = 16384Minimum value size to be swapped.
Default value is 16K Negative value means that memory objects are never swapped
16384Details- Type
- integer

array $_sizes = array()List of object sizes.
This list is used to calculate modification of object sizes
array(
array()Details- Type
- array
Methods

__construct(\Zend_Cache_Backend $backend = null) : voidMemory manager constructor
If backend is not specified, then memory objects are never swapped
| Name | Type | Description |
|---|---|---|
| $backend | \Zend_Cache_Backend |

_create(string $value, boolean $locked) : \Zend_Memory_Container_InterfaceCreate new Zend_Memory object
| Name | Type | Description |
|---|---|---|
| $value | string | |
| $locked | boolean |
| Type | Description |
|---|---|
| \Zend_Memory_Container_Interface |
| Exception | Description |
|---|---|
| \Zend_Memory_Exception |

_generateMemManagerId() : voidThis function is intended to generate unique id, used by memory manager

_swap(\Zend_Memory_Container_Movable $container, integer $id) : voidSwap object data to disk Actualy swaps data or only unloads it from memory, if object is not changed since last swap
| Name | Type | Description |
|---|---|---|
| $container | \Zend_Memory_Container_Movable | |
| $id | integer |

_swapCheck() : voidCheck and swap objects if necessary
| Exception | Description |
|---|---|
| \Zend_MemoryException |

create(string $value = '') : \Zend_Memory_Container_InterfaceCreate new Zend_Memory value container
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| \Zend_Memory_Container_Interface |
| Exception | Description |
|---|---|
| \Zend_Memory_Exception |

createLocked(string $value = '') : \Zend_Memory_Container_InterfaceCreate new Zend_Memory value container, which has value always locked in memory
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| \Zend_Memory_Container_Interface |
| Exception | Description |
|---|---|
| \Zend_Memory_Exception |

getMinSize() : integerGet minimum size of values, which may be swapped
| Type | Description |
|---|---|
| integer |

setMemoryLimit(integer $newLimit) : voidSet memory grow limit
| Name | Type | Description |
|---|---|---|
| $newLimit | integer |
| Exception | Description |
|---|---|
| \Zend_Exception |