Caching "getAttributes()" of a model enable cache for all later model


I’m having a strange problem in my application (Yii Framework 1.1.8).

I called a function as follows:

UserDataModel::model()->cache(3600, $dependency)->getAttributes();

After calling this function I called another model and fetched the data.


To my surprise, ProfileModel was also cached. When I remove the first line (UserDataModel), the ProfileModel fetches the uncached data. Since both models are different, why first model is forcing cache for the next model call ?

Is there anything wrong with my implementation ?



cache is for pipeline usage and each pipeline should be ended with function fetching data which uses all settings from pipeline and resets them for another fetch.

UserDataModel::model()->cache(3600, $dependency)->getAttributes();

does not fetch any data (getAttributes just return default values for model instance used as pipeline holder) so the cache settings remain there and are used by second line of code…

Thanks I got it.