PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

SyncSharedMemory::__construct - Constructs a new SyncSharedMemory object | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

SyncSharedMemory::__construct

(PECL sync >= 1.1.0)

SyncSharedMemory::__constructConstructs a new SyncSharedMemory object

説明

public SyncSharedMemory::__construct ( string $name , integer $size )

Constructs a named shared memory object.

パラメータ

name

The name of the shared memory object.

注意:

If the name already exists, it must be able to be opened by the current user that the process is running as or an exception will be thrown with a meaningless error message.

size

The size, in bytes, of shared memory to reserve.

注意:

The amount of memory cannot be resized later. Request sufficient storage up front.

返り値

The new SyncSharedMemory object. An exception is thrown if the shared memory object cannot be created or opened.

例1 SyncSharedMemory::__construct() example

<?php
// You will probably need to protect shared memory with other synchronization objects.
// Shared memory goes away when the last reference to it disappears.
$mem = new SyncSharedMemory("AppReportName"1024);
if (
$mem->first())
{
    
// Do first time initialization work here.
}

$result $mem->write(json_encode(array("name" => "my_report.txt")));
?>

参考


忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「SyncSharedMemory::__construct - Constructs a new SyncSharedMemory object」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | SyncSharedMemory::__construct - Constructs a new SyncSharedMemory object」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: