Caching With Csqldataprovider

Hello All,

Is it possible to do caching of data from sql server queries when using CSqlDataProvider. If so can anyone please provide some links for documentation about it.

I did a search but found nothing :(

Really need some help here… I have some sql queries which have high execution time and really want to do caching… If some has done this before please guide

See the guide on query caching. [font=“Courier New”]CSqlDataProvider[/font] doesn’t work directly with it, so you’ll possibly have to do the query manipulation yourself and feed the result to a [font=“Courier New”]CArrayDataProvider[/font].




Yii::app()->db->cache( $duration, $dependency, $queryCount );



where $queryCount - number of SQL queries that need to be cached after calling this method. Defaults to 1, meaning that the next SQL query will be cached.

for CSqlDataprovider you probably will need 2 queries (one for count, one for data), but I have never used cache in such scenario, so experiment :)