File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<!-- $Revision$ -->
3
- <!-- EN-Revision: 14767af0f05dffa6fdb9b49e1a1f4e9ca7022a60 Maintainer: mumumu Status: ready -->
3
+ <!-- EN-Revision: 7caf0c13762e7db3e7002b1286f23b65d940e2d0 Maintainer: mumumu Status: ready -->
4
4
<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" >
5
5
6
6
<title >WeakReference クラス</title >
14
14
<para >
15
15
弱い参照により、オブジェクトが破棄されるのを妨げないオブジェクトへの参照を保持することが可能です。
16
16
この機能は、キャッシュのようなデータ構造を実装するのに役立ちます。
17
+ 元のオブジェクトが破棄されている場合、<methodname >WeakReference::get</methodname >
18
+ メソッドを呼び出すと &null; を返します。
19
+ 元のオブジェクトは、<link linkend =" features.gc.refcounting-basics" >refcount</link > が 0 になると破棄されます。
20
+ 弱い参照を作成しても、参照されているオブジェクトの <literal >refcount</literal > は増加しません。
17
21
</para >
18
22
<para >
19
23
<classname >WeakReference</classname > クラスはシリアライズできません。
51
55
<programlisting role =" php" >
52
56
<![CDATA[
53
57
<?php
58
+
54
59
$obj = new stdClass;
55
60
$weakref = WeakReference::create($obj);
61
+
56
62
var_dump($weakref->get());
63
+
57
64
unset($obj);
65
+
58
66
var_dump($weakref->get());
67
+
59
68
?>
60
69
]]>
61
70
</programlisting >
71
80
</para >
72
81
</section >
73
82
83
+ <section role =" changelog" >
84
+ &reftitle.changelog;
85
+ <informaltable >
86
+ <tgroup cols =" 2" >
87
+ <thead >
88
+ <row >
89
+ <entry >&Version; </entry >
90
+ <entry >&Description; </entry >
91
+ </row >
92
+ </thead >
93
+ <tbody >
94
+ <row >
95
+ <entry >8.4.0</entry >
96
+ <entry >
97
+ <methodname >WeakReference::__debugInfo</methodname > の出力に、
98
+ 参照されたオブジェクトを含むようになりました。また、参照が有効ではなくなっている場合は、
99
+ 参照されたオブジェクトは <literal >NULL</literal > となります。
100
+ </entry >
101
+ </row >
102
+ </tbody >
103
+ </tgroup >
104
+ </informaltable >
105
+ </section >
106
+
74
107
</partintro >
75
108
76
109
&language.predefined.weakreference.construct;
You can’t perform that action at this time.
0 commit comments