Here is the thing, i am trying to make use of the query caching feature, but somehow, the queries that should be cached, are still executed.
Beside this, when i do a
var_dump($dependency->getHasChanged());
it always evaluates to true, even if i did no changes into database, so why is that?
To be more clear, here is what i am doing:
$criteria=new CDbCriteria;
$criteria->select='t.box_id, t.title, t.status, t.sort_order';
$criteria->order='t.sort_order ASC, t.box_id DESC';
$dependency=new CDbCacheDependency('SELECT MAX(last_updated) FROM {{footer_box}}');
var_dump($dependency->getHasChanged());//this always evaluates to true.
$boxes=FooterBox::model()->cache(84000, $dependency)->findAll($criteria);
The application log says
Querying SQL: SELECT t.box_id, t.title, t.status, t.sort_order FROM `cms_footer_box` `t` ORDER BY t.sort_order ASC, t.box_id DESC
in ... line ...
Followed by
Querying SQL: SELECT MAX(last_updated) FROM cms_footer_box
in... line ...
And then:
Query result found in cache
in... line ...
And this repeats for each request, but if the query result was found in cache, why the query
Querying SQL: SELECT t.box_id, t.title, t.status, t.sort_order FROM `cms_footer_box` `t` ORDER BY t.sort_order ASC, t.box_id DESC
repeats for every request and more, why $dependency->getHasChanged() evaluates to true ?
What am i missing here ?