APC 清除目录条目
我见过这个: 如何清除 APC 缓存条目?
我对每个文件都有这个工作:
$filename = '/home/testing_code/abc.php';
if (apc_compile_file($filename)) {
if (apc_delete_file($filename)) {
echo "Successfully deleted file $filename from APC cache.<br>", PHP_EOL;
}
}
否无论我怎么玩它,我都找不到基于目录清除的方法,有人知道该怎么做吗?
即像这样:
$filename = '/home/testing_code/*.php';
if (apc_compile_file($filename)) {
if (apc_delete_file($filename)) {
echo "Successfully deleted file $filename from APC cache.<br>", PHP_EOL;
}
}
I have seen this:
How to clear APC cache entries?
And I have this working per file:
$filename = '/home/testing_code/abc.php';
if (apc_compile_file($filename)) {
if (apc_delete_file($filename)) {
echo "Successfully deleted file $filename from APC cache.<br>", PHP_EOL;
}
}
No matter how I play with it, I cant find a way to clear based on a Directory, anyone know how to do this?
i.e. something like this:
$filename = '/home/testing_code/*.php';
if (apc_compile_file($filename)) {
if (apc_delete_file($filename)) {
echo "Successfully deleted file $filename from APC cache.<br>", PHP_EOL;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 apc_cache_info 获取缓存文件列表。对与您的掩码匹配的任何文件调用
apc_delete_file
。您还可以使用 APCIterator 查找与您的掩码匹配的所有文件然后删除它们。请注意,在删除前一个文件之前,您需要将迭代器移动到下一个文件。或者使用迭代器创建所有匹配文件名的数组,然后从您自己的数组中删除它们。在遍历集合时修改它是很棘手的。
没有一个调用可以执行此操作。
Use apc_cache_info to get the list of cached files. Call
apc_delete_file
on any files that match your mask.You can also use an APCIterator to find all files that match your mask and then delete them. Note that you'll want to move the iterator to the next file before you delete the previous one. Or make an array of all matching filenames using the iterator and then delete them from your own array. Modifying a collection while traversing it is tricky.
There is no single call that does this.