Skip to content

Commit

Permalink
Document touch() doesn't clear the stat cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crell committed Dec 13, 2024
1 parent 4bf27ed commit 2c627b1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions reference/filesystem/functions/touch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,27 @@ if (!touch('some_file.txt', $time)) {
<refsect1 role="notes">
&reftitle.notes;
&note.filesystem-time-res;
<note>
<simpara>
Updates to the <literal>mtime</literal> or <literal>atime</literal>
of a file will not be reflected immediately in filesystem operations
such as <function>filemtime</function>. That's because the information
is cached, and this function does not automatically clear the cache.
To have changes reflected in the application immediately, call
<function>clearstatcache</function> on the file.
</simpara>
</note>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>clearstatcache</function></member>
<member><function>fileatime</function></member>
<member><function>filemtime</function></member>
</simplelist>
</para>
</refsect1>

</refentry>
Expand Down

0 comments on commit 2c627b1

Please sign in to comment.