wincache_refresh_if_changed

(PECL wincache >= 1.0.0)

wincache_refresh_if_changed Refreshes the cache entries for the cached files

说明

wincache_refresh_if_changed ([ array $files = NULL ] ) : bool

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.

参数

files

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

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

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.

Example #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));
?>

参见

相关文章
php apc 函数 output a binary dump of cached files and user variables to a filephp apc 函数 deletes files from the opcode cachephp mysqlnd qc 函数 returns information on the current handler the number of cache entries and cache entries if availablephp wincache 函数 retrieves information about files cached in the file cachephp wincache 函数 retrieves information about file cache memory usagephp wincache 函数 retrieves information about files cached in the opcode cachephp wincache 函数 retrieves information about opcode cache memory usagephp wincache 函数 refreshes the cache entries for the cached filesphp wincache 函数 retrieves information about resolve file path cachephp wincache 函数 retrieves information about memory usage by the resolve file path cachephp wincache 函数 retrieves information about files cached in the session cachephp wincache 函数 retrieves information about session cache memory usagephp wincache 函数 adds a variable in user cache only if variable does not already exist in the cachephp wincache 函数 deletes entire content of the user cachephp wincache 函数 deletes variables from the user cachephp wincache 函数 checks if a variable exists in the user cachephp wincache 函数 gets a variable stored in the user cachephp wincache 函数 retrieves information about data stored in the user cachephp wincache 函数 retrieves information about user cache memory usagephp wincache 函数 adds a variable in user cache and overwrites a variable if it already exists in the cache
关注编程学问公众号