Caching: Best Practices
Here are some strategies to leverage the caching features offered by the RSSBus ADO.NET Provider for Facebook.
Read-Only Access to Data with Periodic Updates
A common use for caching is to have an application always query the cached data and only update the cache at set intervals, like once every day or every two hours. There are two ways in which this can be implemented:
- Auto Cache = false, Offline = false. All queries issued by the application explicitly reference the table_name#Cache table. When the cache needs to be updated, the application executes a "CACHE table_name..." statement to bring the cached data up to date.
- Offline = true. Caching is transparent to the application. All queries are executed against the table_name as normal, so most application code does not need to be aware that caching is done. To update the cached data, simply create a separate connection with Offline = false and execute a "CACHE table_name..." statement.
Fast Reporting From Cache
Another common use is to have the application work with live data, but execute more expensive queries (like reporting) against the local cache.
For this, Auto Cache is a good option. Enable Auto Cache and have the application code work with the live data. This will ensure the cache is updated every time SELECT is executed. Reporting logic runs queries on the table_name#Cache tables for better performance (especially for larger data sets).