Stream__SHM
[ class tree: Stream__SHM ] [ index: Stream__SHM ] [ all elements ]

Class: Stream_SHM

Source Location: /Stream_SHM-1.0.0/Stream/SHM.php

Class Overview


This class implements a user-space stream that reads/writes shared memory. It requires the shmop extension for shared memory access.


Author(s):

Version:

  • 1.0

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 50]
This class implements a user-space stream that reads/writes shared memory. It requires the shmop extension for shared memory access.

Sample Usage:

require_once('Stream/SHM.php'); stream_register_wrapper('shm','Stream_SHM') or die("can't register shm"); $shm = fopen('shm://0xabcd:12000','c'); fwrite($shm, 'One Two Three Four'); fseek($shm,4,SEEK_SET); $two = fread($shm,3); // $two is "Two" fclose($shm);

Specify the key of the shared memory segment in decimal or hexadecimal after the "shm://" and then optionally, a colon and the size of the shared memory segment. If you don't specify a size, the segment size defaults to 16384 bytes.

Allowable modes are "a", "c", "w", and "n". For what those modes mean, see: --> http://www.php.net/manual/en/function.shmop-open.php



[ Top ]


Class Variables

$pos =  0

[line 57]

position
  • Var: stream position in the shared memory segment

Type:   string


[ Top ]

$shm =

[line 77]

shared memory segment handle
  • Var: handle to the segment for the shmop_*() functions

Type:   resource


[ Top ]

$shm_key =

[line 64]

shared memory segment key
  • Var: key (for shmop_open()) of the segment

Type:   integer


[ Top ]

$size =  16384

[line 71]

shared memory segment size
  • Var: size of the shared memory segment (default: 16k)

Type:   integer


[ Top ]



Method Detail

stream_close   [line 122]

void stream_close( )

Stream closer

[ Top ]

stream_eof   [line 163]

boolean stream_eof( )

Check stream end-of-file
  • Return: Is the stream position at the end of the stream?

[ Top ]

stream_flush   [line 221]

boolean stream_flush( )

Flush data to the stream
  • Return: Data is always flushed when writing with shmop_write()

[ Top ]

stream_open   [line 88]

boolean stream_open( string $path, string $mode, integer $options, string &$opened_path)

Stream opener
  • Return: Stream opened sucessfully?

Parameters:

string   $path     URL-style path to the segment
string   $mode     mode to open the segment with
integer   $options     stream options
string   &$opened_path     (not used)

[ Top ]

stream_read   [line 134]

string stream_read( integer $count)

Read from stream
  • Return: Data read from the stream

Parameters:

integer   $count     How many bytes to read from the stream

[ Top ]

stream_seek   [line 184]

boolean stream_seek( integer $offset, integer $whence)

Adjust current position in the stream
  • Return: Was the position adjustment successful?

Parameters:

integer   $offset     How many bytes to move the position
integer   $whence     Where to start counting from

[ Top ]

stream_tell   [line 173]

integer stream_tell( )

Get stream position
  • Return: The current position in the stream

[ Top ]

stream_write   [line 151]

integer stream_write( mixed $data)

Write to stream
  • Return: Bytes actually written to the stream

Parameters:

mixed   $data     Data to write to the stream

[ Top ]


Documentation generated on Fri, 30 Apr 2004 22:04:10 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.