mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 07:22:16 +01:00
133 lines
3.7 KiB
XML
133 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 7caf0c13762e7db3e7002b1286f23b65d940e2d0 Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<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">
|
|
|
|
<title>La clase WeakReference</title>
|
|
<titleabbrev>WeakReference</titleabbrev>
|
|
|
|
<partintro>
|
|
|
|
<!-- {{{ WeakReference intro -->
|
|
<section xml:id="weakreference.intro">
|
|
&reftitle.intro;
|
|
<para>
|
|
Las referencias débiles permiten al programador mantener una referencia a un objeto sin impedir su destrucción.
|
|
Son útiles para implementar estructuras como cachés.
|
|
Si el objeto original ha sido destruido, &null; será devuelto
|
|
al llamar al método <methodname>WeakReference::get</methodname>.
|
|
El objeto original será destruido cuando el
|
|
<link linkend="features.gc.refcounting-basics">contador de referencias</link> llegue a cero;
|
|
la creación de referencias débiles no incrementa el <literal>contador de referencias</literal> del objeto referenciado.
|
|
</para>
|
|
<para>
|
|
Las <classname>WeakReference</classname>s no pueden ser serializadas.
|
|
</para>
|
|
</section>
|
|
<!-- }}} -->
|
|
|
|
<section xml:id="weakreference.synopsis">
|
|
&reftitle.classsynopsis;
|
|
|
|
<!-- {{{ Synopsis -->
|
|
<classsynopsis class="class">
|
|
<ooclass>
|
|
<modifier>final</modifier>
|
|
<classname>WeakReference</classname>
|
|
</ooclass>
|
|
|
|
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.weakreference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='WeakReference'])">
|
|
<xi:fallback/>
|
|
</xi:include>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.weakreference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='WeakReference'])">
|
|
<xi:fallback/>
|
|
</xi:include>
|
|
</classsynopsis>
|
|
<!-- }}} -->
|
|
|
|
</section>
|
|
|
|
<section xml:id="weakreference.examples">
|
|
<title>Ejemplo con WeakReference</title>
|
|
<para>
|
|
<example xml:id="weakreference.basic-example">
|
|
<title>Uso Simple de WeakReference</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$obj = new stdClass();
|
|
$weakref = WeakReference::create($obj);
|
|
|
|
var_dump($weakref->get());
|
|
|
|
unset($obj);
|
|
|
|
var_dump($weakref->get());
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
object(stdClass)#1 (0) {
|
|
}
|
|
NULL
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</section>
|
|
|
|
<section role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.4.0</entry>
|
|
<entry>
|
|
La salida de <methodname>WeakReference::__debugInfo</methodname> incluye ahora el objeto referenciado, o <literal>NULL</literal> si la referencia ya no es válida.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</section>
|
|
|
|
</partintro>
|
|
|
|
&language.predefined.weakreference.construct;
|
|
&language.predefined.weakreference.create;
|
|
&language.predefined.weakreference.get;
|
|
|
|
</reference>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|