"hasmany" With Db Caching?

I really like the revised db caching system with the closure/callback.

[size=2]However I’m wondering a couple things…[/size]

[size=2]

[/size]Like: Is it possible to cache a call to a relational function?

Say I have a couple relational functions that are called a lot, and I want to take the caching out of the hands of the calling function.

Seems that with the


static::getDb()->cache()

there is no context except for the connection (although that might be solved with “use”). On top of that the relational functions usually return an iterator and I don’t know if it’s a good thing to change that.

eg.




public function getChildren()

{

   return $this->hasMany(Children::className(), ['parent' => 'id']);

}



Any ideas/suggestions on how to best tackle this?