我是否必须更改源代码才能使用xcache或其他PHP操作码cacher?

时间:2022-09-10 23:15:02

I would like to use a PHP opcode cache, like APC and XCache.

我想使用PHP操作码缓存,如APC和XCache。

TO have benefit from this cachers, do I have to change something on my php code or just install one of them?

要从这个cachers中受益,我是否必须更改我的PHP代码或只安装其中一个?

I have seen there are APIs, do I have to use them?

我看到有API,我必须使用它们吗?

Thank you

谢谢

3 个解决方案

#1


0  

The APIs are to exert manual control over how the caches work, but if they are properly installed and configured, they will "just work".

API将对缓存的工作方式进行手动控制,但如果它们已正确安装和配置,它们将“正常工作”。

#2


0  

About APC: you can just install APC and it will work.
If you want, you can adjust size of memory, allowed for APC.
And I recommend to set this setting:

关于APC:你可以安装APC,它会工作。如果需要,可以调整APC允许的内存大小。我建议设置此设置:

apc.slam_defense = Off

#3


0  

As previous posters have mentioned, once properly installed, APC will "just work" by storing the compiled PHP code to save this having to be done each time. There is nothing else for you to do.

正如之前的海报所提到的,一旦正确安装,APC将通过存储已编译的PHP代码“正常工作”来保存每次必须完成的操作。你没有别的事可做。

However, you can also leverage APC to store settings that you may have previously got from a database lookup for example. Take a look at apc_store and related functions.

但是,您也可以利用APC存储以前从数据库查找中获得的设置。看一下apc_store和相关函数。

#1


0  

The APIs are to exert manual control over how the caches work, but if they are properly installed and configured, they will "just work".

API将对缓存的工作方式进行手动控制,但如果它们已正确安装和配置,它们将“正常工作”。

#2


0  

About APC: you can just install APC and it will work.
If you want, you can adjust size of memory, allowed for APC.
And I recommend to set this setting:

关于APC:你可以安装APC,它会工作。如果需要,可以调整APC允许的内存大小。我建议设置此设置:

apc.slam_defense = Off

#3


0  

As previous posters have mentioned, once properly installed, APC will "just work" by storing the compiled PHP code to save this having to be done each time. There is nothing else for you to do.

正如之前的海报所提到的,一旦正确安装,APC将通过存储已编译的PHP代码“正常工作”来保存每次必须完成的操作。你没有别的事可做。

However, you can also leverage APC to store settings that you may have previously got from a database lookup for example. Take a look at apc_store and related functions.

但是,您也可以利用APC存储以前从数据库查找中获得的设置。看一下apc_store和相关函数。