mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-27 18:31:36 +01:00
- updated for 2.6.3
- updates for new build system - added missing files - corrections from users - revcheck comments for all files - big up to didou and nuno, brilliant work - make test: ok - make: ok
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="api.is.cached">
|
||||
<title>is_cached (gecachte Version existiert)</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>void <function>is_cached</function></funcdef>
|
||||
<paramdef>string <parameter>template</parameter></paramdef>
|
||||
<paramdef>[string <parameter>cache_id</parameter>]</paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<!-- EN-Revision: 1.3 Maintainer: andreas Status: ready -->
|
||||
<refentry id="api.is.cached">
|
||||
<refnamediv>
|
||||
<refname>is_cached (gecachte Version existiert)</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_cached</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Gibt 'true' zurück, wenn ein gültiger Cache für das angegebene Template existiert.
|
||||
Dies funktioniert nur, wenn <link linkend="variable.caching">caching</link> eingeschaltet ist.
|
||||
@@ -16,14 +21,18 @@
|
||||
<example>
|
||||
<title>is_cached</title>
|
||||
<programlisting>
|
||||
$smarty->caching = true;
|
||||
|
||||
if(!$smarty->is_cached("index.tpl")) {
|
||||
|
||||
// Datenbank-Abfragen, Variablen zuweisen...
|
||||
}
|
||||
|
||||
$smarty->display("index.tpl");</programlisting>
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->caching = true;
|
||||
|
||||
if(!$smarty->is_cached("index.tpl")) {
|
||||
// Datenbank-Abfragen, Variablen zuweisen...
|
||||
}
|
||||
|
||||
$smarty->display("index.tpl");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Als optionalen zweiten Parameter können Sie die 'cache_id' übergeben,
|
||||
@@ -32,16 +41,27 @@
|
||||
<example>
|
||||
<title>'is_cached' bei mehreren Template-Caches</title>
|
||||
<programlisting>
|
||||
$smarty->caching = true;
|
||||
|
||||
if(!$smarty->is_cached("index.tpl", "FrontPage")) {
|
||||
|
||||
// Datenbank Abfragen, Variablen zuweisen...
|
||||
}
|
||||
|
||||
$smarty->display("index.tpl","FrontPage");</programlisting>
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->caching = true;
|
||||
|
||||
if(!$smarty->is_cached("index.tpl", "FrontPage")) {
|
||||
// Datenbank Abfragen, Variablen zuweisen...
|
||||
}
|
||||
|
||||
$smarty->display("index.tpl", "FrontPage");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<note>
|
||||
<title>Technische Bemerkung</title>
|
||||
<para>
|
||||
Wenn <literal>is_cached</literal> true zurück gibt, wird die Ausgabe geladen. Alle weiteren Aufrufe von <link linkend="api.display">display()</link> oder <link linkend="api.fetch">fetch()</link> werden aus diesem Cache bedient. Dies verhindert eine Race Condition, die auftauchen könnte, wenn ein anderes Script das besagte Template aus dem Cache löscht. Das bedeutet natürlich auch, dass <link linkend="api.clear.cache">clear_cache()</link> und andere Cache spezifische Einstellungen keine Auswirkungen haben, nachdem <literal>is_cached</literal> true zurückgegeben hat.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
@@ -61,4 +81,4 @@ End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
-->
|
||||
|
||||
Reference in New Issue
Block a user