You create a cache using the Create Cache statement (see Create Cache (EXT)). A cache can be created on a single table or on a set of related tables. When creating a cache on a single table, you specify the name of the table to cache and optionally a filter for the table. The filter determines whether the cache holds all the data in the remote table or a subset of the data that matches the filter. You can also specify attributes for the Create Cache statement that determine:

  • Whether the cache data is held on disk or in memory
  • How often the cache data is refreshed
  • If the cache is initially enabled
  • If the driver checks to see if a refresh is needed at connect time

Creating a cache for a set of related tables is similar to creating a cache on a single table, except that a primary table and one or more referencing tables are specified. This is useful if you want to cache a subset of data for a table and also cache data related to that subset of data. For example, suppose you have three tables (named Account, Contact, and Opportunity), where both a contact and an opportunity belong to a particular account. Using a relational cache, you could specify that accounts that have had activity in the past year be cached, as well as caching the opportunities and contacts for only those cached accounts.