public function dumpFile($files, $vars = array(), $filename = null, $flags = 0) { if (CACHE_STATUS) { apc_bin_dumpfile($files, $vars, $filename, $flags); } return false; }
public function dumpFile($files, $vars = array(), $filename = NULL, $flags = 0) { if (_cacheStatus) { apc_bin_dumpfile($files, $vars, $filename, $flags); } return FALSE; }
<?php apc_compile_file($argv[1]); echo apc_bin_dumpfile(array($argv[1]), null, $argv[2]); ?>
error_reporting(E_ALL); ini_set("display_errors", 1); echo "<pre>"; $is_apc_installed = extension_loaded('apc'); echo "[{$is_apc_installed}]" . PHP_EOL; // Example #1 A apc_add() example $bar = 'BAR'; apc_add('foo', $bar); print_r(apc_fetch('foo')); //apc_delete('foo'); echo "\n"; $bar = 'NEVER GETS SET NEW '; apc_add('foonew', $bar); print_r(apc_fetch('foonew')); apc_delete('foo'); echo "\n"; apc_cas('foo', 1, 2); print_r(apc_fetch('foo')); print_r(apc_cache_info()); print_r(apc_bin_dump()); apc_bin_dumpfile(array(), array('foo', 'foonew'), "aa.txt"); echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>"; echo "<br/>";
/** * Output a binary dump of the given files and user variables from the APC cache to the named file * * @link http://php.net/manual/en/function.apc-bin-dumpfile.php * * @param string[]|null $files * The file names being dumped. * @param string[]|null $user_vars * The user variables being dumped. * @param string $filename * The filename where the dump is being saved. * @param int $flags * Flags passed to the filename stream. See the file_put_contents() documentation for details. * @param resource $context * The context passed to the filename stream. See the file_put_contents() documentation for details. * * @return int bool number of bytes written to the file, otherwise false if APC * is not enabled, filename is an invalid file name, filename can't be opened, * the file dump can't be completed (e.g., the hard drive is out of disk space), * or an unknown error was encountered. */ public function bin_dumpfile($files, $user_vars, $filename, $flags = 0, $context = null) { return apc_bin_dumpfile($files, $user_vars, $filename, $flags, $context); }
/** * @see \Components\Cache_Backend::dump() dump */ public function dump($filename_) { // FIXME Produces segfault on load if parameters are set to null / everything is dumped. return apc_bin_dumpfile([], [], $filename_); }
$arrCacheFile = $arrCacheFileFailed = array(); /* bin 目的目录检测*/ if (!is_dir(APCBIN)) { if (!mkdir(APCBIN, 0777, true)) { echo APCBIN, ' can\'t to create!' . NEWLINE; exit; } } apc_clear_cache('user'); //清空导出之前的缓存 /* 循环读取需要cache的目录*/ foreach ($arrCacheDir as $value) { compileDir($value); } /* 生成bin文件*/ if (!apc_bin_dumpfile($arrCacheFile, array(), APCBIN . DIRECTORY_SEPARATOR . BINNAME . '_' . $strDateTime)) { exit('write to ' . APCBIN . DIRECTORY_SEPARATOR . BINNAME . '_' . $strDateTime . ' failed!!!' . NEWLINE); } $strBinMd5 = md5_file(APCBIN . DIRECTORY_SEPARATOR . BINNAME . '_' . $strDateTime); /* 未被缓存的php警告*/ foreach ($arrCacheFileFailed as $value) { echo $value, " cant't to cached ....." . NEWLINE; } /* 清空被缓存文件*/ replaceFile($strBinMd5); /* 复制被过滤文件 */ moveDropFile($arrDropFile); /* 复制需要被复制文件 */ moveDropFile($arrCopyFile); /* 复制被过滤目录 */ moveDropDir($arrDropDir);