Navigation:  DAO Object Classes > DaoRecordset Class >

DaoRecordset:FillCache() Method

Previous pageReturn to chapter overviewNext page


Fills the cache for an ODBC derived Recordset



liRows(Optional) A long that specifies the number of rows to store in the cache. If you omit this argument, the value is determined by the CacheSize

property setting.

oBookMark(Optional) A bookmarkobject The cache is filled starting from the record indicated by this bookmark. If you omit this argument, the cache is filled starting from the record indicated by the CacheStart






















Caching improves the performance of an application that retrieves data from a remote server. A cache is space in local memory that holds the data most recently retrieved from the server; this assumes that the data will probably be requested again while the application is running. When a user requests data, the Microsoft Jet database engine checks the cache for the data first rather than retrieving it from the server, which takes more time. The cache doesn't save data that doesn't come from an ODBC data source.


Rather than waiting for the cache to be filled with records as they are retrieved, you can use the FillCache method to explicitly fill the cache at any time. This is a faster way to fill the cache because FillCache retrieves several records at once instead of one at a time. For example, while you view each screenful of records, your application uses FillCache to retrieve the next screenful of records for viewing.


Any Microsoft Jet-connected ODBC data source that you access with Recordset objects can have a local cache. To create the cache, open a Recordset object from the remote data source, and then set the CacheSize and CacheStart properties of the Recordset.

If liRows and oBookMark create a range of records that is partially or entirely outside the range of records specified by the CacheSize and CacheStart properties, the portion outside this range is ignored and will not be loaded into the cache.

If FillCache requests more records than the number remaining in the remote data source, Microsoft Jet retrieves only the remaining records, and no error occurs.



Records retrieved from the cache don't reflect concurrent changes that other users made to the source data.
FillCache only retrieves records not already cached. To force an update of all the cached data, set the CacheSize property of the Recordset to 0, reset it to the size of the cache you originally requested, and then use FillCache.





See Also