APC 清除目录条目

发布于 2024-12-24 02:39:47 字数 708 浏览 2 评论 0原文

我见过这个: 如何清除 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

宁愿没拥抱 2024-12-31 02:39:47

使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文