Caching Explicitly
With explicit caching (Auto Cache is set to false), you decide exactly what data gets stored in the cache and when it is updated. Explicit caching gives you full control over the cache contents by using CACHE Statements.
To load data in the cache, simply execute a "CACHE SELECT * from table_name WHERE ..." statement and any matching data in table_name will be loaded into the corresponding table.
Create or Update the Cached Table Explicitly
The command below will update modified rows and add missing rows in the cached table.
However, it will not delete extra rows that are already in the cache.
String cmd = "CACHE SELECT * FROM Account", connection"; stat.execute(cmd); connection.close();
Update Cached Table to Contain Only the Live Data
The command below will update modified rows and add missing rows in the cached table.
It also will delete rows in the cache table that are not present in the live data source.
String cmd = "CACHE WITH TRUNCATE SELECT * FROM Account"; stat.execute(cmd); connection.close();