I have a KronCommand class that extends CConsoleCommand class and inside
run(){
$a = 100;
$r=Something::model()->findByPk("data");
$r->val = $r->val + $a;
$r->save(); //this works
//but i also want to cache this number so im not calling the db over an over.
Yii::app()->cache->set("data", $r->val);//this does not work.
}
Now the very same code worked when i had the logic in a controller and called it via wget from cron. But trying the proper way, with console commands isnt working.
No, its not retrieve from the cache value because it might not actually be in cache, i store the actual value in the db (which works), but its not setting the cache to that value.