Caching Usage


I am fairly new to using caching in yii. Can I use an an active record caching for a specific record?

$post = Post::model()->findByPk(1);

How will this work? What if the request is post ID 2? Will it put it in the cache and then serve ids 1 and 2 using a cache?

Thank you.

guide is very comprehensive try the query caching there is a section for activerecord as well.

Thank you sir :) I’ll try reading it.


I also have a question about data caching. What if I cache a user with ID 1 and also cache a different user with ID 2 and so on. Can I cache up to unlimited numbers depending on the users logged in? Or do I not use cache for this scenario. I am trying to cache a profile view page.

Thank you,