Disable cache for raw SQL query

Author Message

Scott Foster

Wednesday 16 February 2011 9:42:44 am

I'm trying to run a raw sql query and have it not be cached. When I run the following

$db = eZDB::instance( );
$query = 'select * from table';
$data = $db->arrayQuery( $query ); 
print_r ( $data );

It returns the results the first time, but not the second, third, etc time. I'm assuming ez publish caches those results somewhere. Is there anyway to disable cache just for a particular query?

André R.

Thursday 17 February 2011 10:17:32 am

My guess is that the code above is inside a template operator or similar which is called inside a template that is cached in view cache or cache-block.

You can disable both using site.ini settings for development, but for prod you should never disable cache unless you have a very low traffic site and you don't care about its performance, and green house gases.. :)

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.