新的 APCu APC 用户缓存是否在进程之间共享? [英] Is the new APCu APC User Cache shared between processes?

查看:26
本文介绍了新的 APCu APC 用户缓存是否在进程之间共享?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算使用 php5-apcu ubuntu 包.

I am planning to use the php5-apcu ubuntu package.

进程间是否共享数据?换句话说,如果我在一个网站加载中设置了一个缓存条目,另一个网站加载是否有可用的缓存条目,即使它是由另一个进程提供的?

Is the data shared between processes? In other words, if I set a cache entry in one website load, will another website load have the cache entry available, even if it is served with another process?

这是如何工作的:

  • apache2 php prefork 模块
  • 具有多个工作器的 php5 fpm
  • php-cli

推荐答案

https://github.com/krakjoe/apcu/issues/121

规则是只有子进程可以访问其父进程创建的内容;在 FCGI 中产生的进程不一定是其父进程的子进程,它们可能不是实际的分支.如果您的进程管理器像传统的 FCGI/CGI 一样工作,那么您将无法共享,如果它像 FPM 一样工作,并在父级中初始化 PHP 并派生子解释器,那么您将没有问题.

The rule is that only child processes can access what their parent created; In FCGI spawned processes are not necessarily a child of their parent, they may not be actual forks. If your process manager works like conventional FCGI/CGI then you will not be able to share, if it works like FPM, and initializes PHP in a parent and forks child interpreters then you will have no problem.

Apache 的 prefork 和 PHP 的 FPM 将在工作进程之间共享(通过父进程的内存空间).

Apache's prefork and PHP's FPM will share between worker processes (via the parent's memory space).

CLI 不会,因为每个 CLI 调用都是一个单独的过程.

The CLI will not, as each CLI invocation is a separate process.

您可以考虑使用 memcached 或 redis 之类的东西作为替代.

You might consider something like memcached or redis as an alternative.

这篇关于新的 APCu APC 用户缓存是否在进程之间共享?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆