PHP Doku:: Refreshes the cache entries for the cached files - function.wincache-refresh-if-changed.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDas Verhalten von PHP beeinflussenWindows Cache for PHPWinCache Funktionenwincache_refresh_if_changed

Ein Service von Reinhard Neidl - Webprogrammierung.

WinCache Funktionen

<<wincache_ocache_meminfo

wincache_rplist_fileinfo>>

wincache_refresh_if_changed

(PECL wincache >= 1.0.0)

wincache_refresh_if_changed Refreshes the cache entries for the cached files

Beschreibung

bool wincache_refresh_if_changed ([ array $files ] )

Refreshes the cache entries for the files, whose names were passed in the input argument. If no argument is specified then refreshes all the entries in the cache.

Parameter-Liste

files

An array of file names for files that need to be refreshed. An absolute or relative file paths can be used.

Rückgabewerte

Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.

Beispiele

WinCache performs regular checks on the cached files to ensure that if any file has changed then the corresponding entry in the cache is updated. By default this check is performed every 30 seconds. If, for example, a PHP script updates another PHP script where the application's configuration settings are stored, then it may happen that after the configuration settings have been saved to a file, the application is still using old settings for some time until the cache is refreshed. In those cases it may be preferrable to refresh the cache right after the file has been changed. The following example shows how this can be done.

Beispiel #1 A wincache_refresh_if_changed() example

<?php 
$filename 
'C:\inetpub\wwwroot\config.php';
$handle fopen($filename'w+');
if (
$handle === FALSE) die('Failed to open file '.$filename.' for writing');
fwrite($handle'<?php $setting=something; ?>');
fclose($handle);
wincache_refresh_if_changed(array($filename));
?>

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)