Client-Side Result Set Caching

Client-side result set caching is a feature of the SQL Relay API that allows you to save whatever part of the result set that you have fetched so far to a local file. This file can be re-opened later and rows that were already fetched can be read from it again and new rows can be appended to it.

When used with suspended transactions efficient paging can be accomplished.

For example, if you have 1000 items that you want to display, 50 at a time, you can select the rows, begin fetching them and cache them to a local file. When the app is done fetching the first 50 items, the transaction can be suspended and picked up again by the next invocations of the app. If the user wants to view the next 50 items, then 50 more rows can be fetched and cached. If the user wants to view the previous 50 items, then there is no need to run the query again, the rows can just be fetched from the file.

Cached result sets have a TTL (time-to-live) setting and are periodically removed by the sqlr-cachemanager daemon.

The programming docs for each language give more detail on this subject.