Model Caching

Hi all,

Does Yii2 support model caching like Yii 1 ? How can we archive that ?



Have a look here,

Thanks alex-w.

But I still wonder about this. For example I place these code in the query caching block

$user = User::find() -> all() ;

Will it get data from the cache the next time it execute that line of code. In Yii1 there is a way to save the model to the cache like : User::model()->cache() … Are these 2 style the same ?


I think they are different. I think the cache blocks are the same like in Yii 1.x the beginCache() and endCache() methods.