API Documentation

Zend/Memory/Manager.php

Show: inherited
Table of Contents

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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Memory  
Version
$Id: Manager.php 24594 2012-01-05 21:27:01Z matthew $  

\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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprivate\Zend_Cache_Backend_Interface  $_backend= 'null'

Object storage backend

Default valuenullDetails
Type
\Zend_Cache_Backend_Interface
Propertyprivate\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

Default valuenullDetails
Type
\Zend_Memory_Container_Movable
Propertyprivateinteger  $_managerId= ''

Unique memory manager id

Details
Type
integer
Propertyprivateinteger  $_memoryLimit= '-1'

Memory grow limit.

Default value is 2/3 of memory_limit php.ini variable Negative value means no limit

Default value-1Details
Type
integer
Propertyprivateinteger  $_memorySize= '0'

Overall size of memory, used by values

Default value0Details
Type
integer
Propertyprivateinteger  $_minSize= '16384'

Minimum value size to be swapped.

Default value is 16K Negative value means that memory objects are never swapped

Default value16384Details
Type
integer
Propertyprivateinteger  $_nextId= '0'

Id for next Zend_Memory object

Default value0Details
Type
integer
Propertyprivatearray  $_sizes= 'array()'

List of object sizes.

This list is used to calculate modification of object sizes

array( => , ...)

Default valuearray()Details
Type
array
Propertyprivatearray  $_tags= ''

Tags array, used by backend to categorize stored values

Details
Type
array
Propertyprivatearray  $_unloadCandidates= 'array()'

List of candidates to unload

It also represents objects access history. Last accessed objects are moved to the end of array

array( => , ... )

Default valuearray()Details
Type
array

Methods

methodpublic__construct( \Zend_Cache_Backend $backend = null ) : void

Memory manager constructor

If backend is not specified, then memory objects are never swapped

Parameters
Name Type Description
$backend \Zend_Cache_Backend
methodpublic__destruct( ) : void

Object destructor

Clean up backend storage

methodprivate_commit( ) : void

Commit modified object and put it back to the loaded objects list

methodprivate_create( string $value, boolean $locked ) : \Zend_Memory_Container_Interface

Create new Zend_Memory object

Parameters
Name Type Description
$value string
$locked boolean
Returns
Type Description
\Zend_Memory_Container_Interface
Throws
Exception Description
\Zend_Memory_Exception
methodprivate_generateMemManagerId( ) : void

This function is intended to generate unique id, used by memory manager

methodprivate_swap( \Zend_Memory_Container_Movable $container, integer $id ) : void

Swap 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
methodprivate_swapCheck( ) : void

Check and swap objects if necessary

Throws
Exception Description
\Zend_MemoryException
methodpubliccreate( string $value = '' ) : \Zend_Memory_Container_Interface

Create new Zend_Memory value container

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Memory_Container_Interface
Throws
Exception Description
\Zend_Memory_Exception
methodpubliccreateLocked( string $value = '' ) : \Zend_Memory_Container_Interface

Create new Zend_Memory value container, which has value always locked in memory

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Memory_Container_Interface
Throws
Exception Description
\Zend_Memory_Exception
methodpublicgetMemoryLimit( ) : integer

Get memory grow limit

Returns
Type Description
integer
methodpublicgetMinSize( ) : integer

Get minimum size of values, which may be swapped

Returns
Type Description
integer
methodpublicsetMemoryLimit( integer $newLimit ) : void

Set memory grow limit

Parameters
Name Type Description
$newLimit integer
Throws
Exception Description
\Zend_Exception
methodpublicsetMinSize( integer $newSize ) : void

Set minimum size of values, which may be swapped

Parameters
Name Type Description
$newSize integer
Documentation was generated by DocBlox 0.15.1.