Which cache storage for page and fragment caching

Hello guys,

I want to optimize my website by using caching mechanism. I read and re-read the Yii2 guide. I googled to understand the different type of caching proposed by Yii2 but I’m still confused.

Which cache storage should I use for fragment and/or page caching? APCu or Redis or another? My host provider supports APCu and Redis. I may also do some query caching eventually.


APCu is good if you have extra memory available and there’s a single instance of the server. Redis is great for multiple servers setup. File cache is fine if you have SSD but low on memory.

Thanks for the reply.

Does this imply that APCu can do only memory caching and not file caching?

Yes. File caching in recent PHP versions is done by OpCache.

Got it!

Thanks for your help samdark!