Forums / Developer / Disable cache for raw SQL query

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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 Exponential 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