Cache Groups

You can cache data in an Oracle database by creating a cache group in a TimesTen database. A cache group can be created to cache a single Oracle database table or a set of related Oracle database tables.

The cached data from the Oracle database can consist of all the rows and columns or a subset of the rows and columns in the Oracle database tables.

Cache supports the following features:

  • Applications can both read from and write to cache groups.

  • Cache groups can be refreshed (upload the Oracle database data into the cache group) automatically or manually.

  • Cache updates can be sent to the Oracle database automatically or manually. The updates can be sent synchronously or asynchronously.

The TimesTen database interacts with the Oracle database to perform all of the synchronous cache group operations, such as creating a cache group and propagating updates between the cache group and the Oracle database. A process called the cache agent performs asynchronous cache operations, such as loading data into the cache group, manually refreshing the data from the Oracle database to the cache group, and automatically refreshing the data from the Oracle database to the cache group.

For full information about cache groups, see Overview of Cache Groups in the Oracle TimesTen In-Memory Database Cache Guide.

Figure 7-1 illustrates the cache features and processes in TimesTen.

Each cache group has a root table that contains the primary key for the cache group. Rows in the root table may have one-to-many relationships with rows in child tables, each of which may have one-to-many relationships with rows in other child tables.

A cache instance is the set of rows that are associated by foreign key relationships with a particular row in the root table. Each primary key value in the root table specifies a cache instance. Cache instances form the unit of cache loading and cache aging. No table in the cache group can be a child to more than one parent in the cache group. Each cache record belongs to only one cache instance and has only one parent in its cache group.

The most commonly used cache group types are:

  • Read-only cache group - A read-only cache group enforces a caching behavior in which committed updates to the Oracle database tables are automatically refreshed to the corresponding cache tables in the TimesTen database.

  • Asynchronous writethrough (AWT) cache group - An AWT cache group enforces a caching behavior in which committed updates to cache tables in the TimesTen database are automatically propagated to the corresponding the Oracle database tables asynchronously.

Other types of cache groups are:

  • Synchronous writethrough (SWT) cache group - An SWT cache group enforces a caching behavior in which committed updates to cache tables in the TimesTen database are automatically propagated to the corresponding Oracle database tables synchronously.

  • User managed cache group - A user managed cache group defines customized caching behavior. For example, individual cache tables in a user managed cache are not constrained to be all of the same type. Some tables may be defined as read-only while others may be defined as updatable.

If you have multiple TimesTen databases, the data in cached tables is not shared among separate TimesTen databases. Consequently, the content of the databases may overlap with no coordination from the cache unless your applications logically partition their data between different nodes or use read-only cache groups.

TimesTen Classic supports all cache group types; TimesTen Scaleout only supports static read-only cache groups.

See Cache Group Types in the Oracle TimesTen In-Memory Database Cache Guide.