Search code examples
phpyiimemcachedapc

What should I use for caching?


I am developing an application using the Yii framework. Application will have a multiple server configuration. I read about Memcache and APC.

Can you tell me what works better with Yii between APC and Memcache?


Solution

  • Although both APC and Memcache are used for different purpose, you should use both. Since you have multiple servers, memcache will help in caching and maintaining user data state across servers and APC will help in speed up script execution time.

    APC compiles the plain PHP code into machine code and saves it so in all future requests, compilation time can be saved. Here's the link which can give you some idea on how to use it with Yii - http://www.yiiframework.com/wiki/312/getting-the-most-out-of-apc-for-yii/