FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Parallel Class Reference

Component for parallel execution. More...

Inheritance diagram for Parallel:
Component Thing

Public Member Functions

 worker ($id, $component_name, $func_name, $params=null)
 
 execute ($component_name, $func_name, $params=null)
 Execute a command in the background. More...
 
 ready (... $ids)
 Check if the calls are ready. More...
 
 result ($id)
 Get the result from the parallel call. More...
 
- Public Member Functions inherited from Component
 __construct ($fred, $config=null)
 
 __destruct ()
 
 clientConfig ()
 Public configuration. More...
 
 config ($key, $default=null)
 Retrieve a config value. More...
 
 ping ()
 Ping function. More...
 
 filemtime ($filename)
 Filemtime with session cache. More...
 
 component ($name)
 Get a component (local or default). More...
 
 components (... $names)
 Get multiple components in an array. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

 $timeout = 600
 Time after which the results may be removed by the garbage collector (seconds). More...
 
 $garbageChance = 10000
 Run garbage collector once every ... times a call is not ready. More...
 
 $lastError = []
 
- Data Fields inherited from Component
 $filemtimeTtl = 0
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Member Functions

 filename ($id)
 
 writeResult ($id, $result=null)
 
 readResult ($id)
 
 garbage ()
 
 getAvailable ()
 
- Protected Member Functions inherited from Component
 init ()
 
 done ()
 
 getSession ()
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 alias ($alias, $property, $object=null)
 Define an alias for a property (of another object). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_path = null
 Path for storing the result files. More...
 
 $_ext = '.dat'
 
 $_initCode = null
 Initialization code (PHP). More...
 
 $_fredVar = '$fred'
 Name for the variable that holds the \Rsi\Fred object after initalization. More...
 
- Protected Attributes inherited from Component
 $_fred = null
 
 $_config = null
 
 $_name = null
 
 $_components = []
 Local components (key = component name, value = component). More...
 
 $_session = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 
 $_aliases = []
 Alias properties (key = alias, value = [object,property]). More...
 

Detailed Description

Component for parallel execution.

Definition at line 8 of file Parallel.php.

Member Function Documentation

◆ execute()

execute (   $component_name,
  $func_name,
  $params = null 
)

Execute a command in the background.

Parameters
string$component_nameComponent to run the command on.
string$func_nameFunction to call.
array$paramsParameters for the call.
Returns
string Reference ID for the call (false on error).

Definition at line 58 of file Parallel.php.

◆ filename()

filename (   $id)
protected

Definition at line 19 of file Parallel.php.

◆ garbage()

garbage ( )
protected

Definition at line 71 of file Parallel.php.

◆ getAvailable()

getAvailable ( )
protected

Definition at line 107 of file Parallel.php.

◆ readResult()

readResult (   $id)
protected

Definition at line 29 of file Parallel.php.

◆ ready()

ready (   $ids)

Check if the calls are ready.

Parameters
string$idsReference ID's for the calls.
Returns
bool True if all calls are ready.

Definition at line 86 of file Parallel.php.

◆ result()

result (   $id)

Get the result from the parallel call.

Parameters
string$idReference ID for the call.
Returns
mixed

Definition at line 101 of file Parallel.php.

◆ worker()

worker (   $id,
  $component_name,
  $func_name,
  $params = null 
)

Definition at line 35 of file Parallel.php.

◆ writeResult()

writeResult (   $id,
  $result = null 
)
protected

Definition at line 25 of file Parallel.php.

Field Documentation

◆ $_ext

$_ext = '.dat'
protected

Definition at line 15 of file Parallel.php.

◆ $_fredVar

$_fredVar = '$fred'
protected

Name for the variable that holds the \Rsi\Fred object after initalization.

Definition at line 17 of file Parallel.php.

◆ $_initCode

$_initCode = null
protected

Initialization code (PHP).

Definition at line 16 of file Parallel.php.

◆ $_path

$_path = null
protected

Path for storing the result files.

Definition at line 14 of file Parallel.php.

◆ $garbageChance

$garbageChance = 10000

Run garbage collector once every ... times a call is not ready.

Definition at line 11 of file Parallel.php.

◆ $lastError

$lastError = []

Definition at line 12 of file Parallel.php.

◆ $timeout

$timeout = 600

Time after which the results may be removed by the garbage collector (seconds).

Definition at line 10 of file Parallel.php.


The documentation for this class was generated from the following file: