File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22<!-- $Revision$ -->
3- <!-- EN-Revision: 14767af0f05dffa6fdb9b49e1a1f4e9ca7022a60 Maintainer: mumumu Status: ready -->
3+ <!-- EN-Revision: cd391e65a613a729f9bbded2b1249e2d7143400c Maintainer: mumumu Status: ready -->
44<reference xml : id =" class.weakreference" role =" class" xmlns =" http://docbook.org/ns/docbook" xmlns : xlink =" http://www.w3.org/1999/xlink" xmlns : xi =" http://www.w3.org/2001/XInclude" >
55
66 <title >WeakReference クラス</title >
1414 <para >
1515 弱い参照により、オブジェクトが破棄されるのを妨げないオブジェクトへの参照を保持することが可能です。
1616 この機能は、キャッシュのようなデータ構造を実装するのに役立ちます。
17+ 元のオブジェクトが破棄されている場合、<methodname >WeakReference::get</methodname >
18+ メソッドを呼び出すと &null; を返します。
19+ 元のオブジェクトは、<link linkend =" features.gc.refcounting-basics" >refcount</link > が 0 になると破棄されます。
20+ 弱い参照を作成しても、参照されているオブジェクトの <literal >refcount</literal > は増加しません。
1721 </para >
1822 <para >
1923 <classname >WeakReference</classname > クラスはシリアライズできません。
5155 <programlisting role =" php" >
5256<![CDATA[
5357<?php
58+
5459$obj = new stdClass;
5560$weakref = WeakReference::create($obj);
61+
5662var_dump($weakref->get());
63+
5764unset($obj);
65+
5866var_dump($weakref->get());
67+
5968?>
6069]]>
6170 </programlisting >
You can’t perform that action at this time.
0 commit comments