!--a11y-->
Cache Mode 
The cache mode determines whether and in what ways the query results and navigational states calculated by the OLAP processor as highly compressed data are to be saved in a cache. You can set the respective mode in Customizing as the standard value for an InfoProvider and in the Query Monitor for a query.
Caching is a means of improving query performance. However care should be taken to balance benefits against costs:
· Benefit: Caching improves the answer time for queries
· Costs: Expenditure involved in organizing and retaining data in the cache
You are able to hold the cache data in the main memory, distributed to an application server or in a network. The option that you choose depends on various parameters. These include:
· How often the query is requested
We recommend that you save queries that are requested particularly frequently in the cache. The main memory cache is particularly fast but restricted by its size. Swapping cached data does cancel out limitations on the main memory but simultaneously affects performance. There are practically no limitations on memory space available in the database or in the file system for the persistent cache. Accessing compressed data directly in the persistent cache is also beneficial in terms of performance.
· The complexity of the query
Caching does bring advantages in terms of performance, particularly with more complex queries as evaluating these requires a higher level of effort. We recommend that complex data processed by the OLAP processor is held in the cache. (Therefore the cache mode Main Memory Without Swapping is less suitable for queries of this type.)
· How often data is loaded
Using the cache is barely advantageous if query-relevant data is often changed and therefore has to be loaded frequently. The cache has to be regenerated every time. If cached data is held in the main memory, data from frequently called-up queries can be displaced. Subsequently your call-up takes more time.
The following modes are supported for the global cache:
...
1. Cache is Inactive (0)
The cross-transactional cache is deactivated.
The following modes are possible for the active cache: The cross-transactional cache is activated.
2. Main Memory Cache Without Swapping (1)
The cache data is stored in the main memory. When the cache memory has been exhausted, excess data is removed according to the LRU algorithm, i.e. deleted from the memory. When a query is subsequently requested, the result is read from the InfoProvider once again.
3. Main Memory Cache with Swapping (2)
The cache data is stored in the main memory. When the caching memory is used up, the excess data is written to a background and can be loaded back into the cache memory when making another request.

After query-relevant data has been loaded again, the background store can no longer be used.
4. Persistent Cache per Application Server (3)
The cache data is stored persistently as a database table or as a file in a directory attainable from the application server. We recommend that you choose a directory that is proximate to the application server.
When you save the cache data in a database table
this puts a strain on the database. However, it is also then quicker to access
uncached data in the database. In
comparison to storing data in, for example, a star schema (see
InfoCube), fewer
tables are read and fewer indexes are accessed.
5. Cross-Application Server Persistent Cache (4)
The cache data is stored persistently as a cross-application server database table or file in a file system in the network, accessed from the application server. In this mode there is no displacement of data and no restriction on memory size. More space is required but this method also saves time.
¡ Database table: Strain is put on the database instance for the table.
¡ File: Strain is put on the network node operating system for the file.
¡ In addition, the application server that calculates the data and network communication has to be taken into account with both storage types.
The following table offers an overview of the available modes for an active cache:
Active cache mode
Property |
Main memory cache |
Persistent Cache |
||
Without swapping |
With swapping |
per application server |
Cross-application server |
|
Removal |
Yes (LRU algorithm and delete) |
Yes (LRU algorithm and swapping) |
No |
No |
Swapping |
No |
Yes |
No |
No |
Global cache size |
Restricted |
Main memory restricted, outsourced part not restricted |
Unrestricted |
Unrestricted |
File name |
No |
With swapping in flat files: The data removed is to be found under the file name |
With flat file caches: All data is to be found under the file name The application server is one element of the file name |
With flat file caches: All data is to be found under the file name The application server is not an element of the file name |
For the active cache modes listed under 3-5 (Main Memory Cache with Swapping, Persistent Cache per Application Server, and Cross-Application Server) you can determine how the removed or cached data is to be stored.You can choose from the following persistence modes:
· Inactive: If you choose this option the system resets the cache mode to Main Memory Cache Without Swapping (1).
· Flat file: Storage in a file.
· Cluster Table: Storage in a non-transparent database table of type CLUSTER.
· Transparent Table (BLOB): Storage in a transparent database table with BLOB (Binary Large OBject).

When compared to the Cluster Table, the Transparent Table (BLOB) leads to better system performance where you have large result sets as fewer database operations have to be performed. With smaller result sets the Cluster Table can be advantageous as BLOB fields necessitate a great administrative effort in terms of the database.
These persistence mode settings allow you to test which persistent storage produces the best performance in your system environment for each individual query.
If you do not define a persistence mode for the query the persistence mode maintained in Customizing as the default mode will be used for all the queries created for an InfoProvider.
You can find additional information about the various ways of setting the cache mode for an InfoProvider or a query under Query Properties.
You
can find additional information about the global cache parameter and the
amount of memory used by the runtime object under
OLAP Cache
Monitor.