Updating data source
The method cache() is provided as a convenient way of setting this property and query Caching Dependency on the fly.
the ID of the cache application component that is used to cache the table metadata.
Note that each time after executing a SQL statement (whether executed on DB server or fetched from query cache), this property will be reduced by 1 until 0.
number of seconds that query results can remain valid in cache.
Note, this property is only effective for PHP 5.1.3 or above.
If you override this method, make sure to call the parent implementation so that the component can be marked as initialized. This method is invoked right after the db connection is established.
The default implementation is to set the charset for My SQL, Maria DB and Postgre SQL database connections.
In order to use this method, enable Profiling has to be set true. By setting the $duration parameter to be 0, the query caching will be disabled.
Otherwise, query results of the new SQL statements executed next will be saved in cache and remain valid for the specified duration.