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 license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Memory
- Version
- $Id$
\Zend_Memory_Manager
Package: Zend_Memory











Memory manager
This class encapsulates memory menagement operations, when PHP works
in limited memory mode.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 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
Default valuenullDetails
integer $_memoryLimit = -1Memory grow limit.
Default value is 2/3 of memory_limit php.ini variable
Negative value means no limit
Default value-1Details- Type
- integer

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

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

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

_create(string $value, boolean $locked) : \Zend_Memory_Container_InterfaceCreate new Zend_Memory object
Parameters
Returns
Throws
| 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
Parameters
| Name | Type | Description |
|---|---|---|
| $container | \Zend_Memory_Container_Movable | |
| $id | integer |

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

create(string $value = '') : \Zend_Memory_Container_InterfaceCreate new Zend_Memory value container
Parameters
Returns
Throws
| 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
Parameters
Returns
Throws
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| \Zend_Memory_Container_Interface |
| Exception | Description |
|---|---|
| \Zend_Memory_Exception |

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