MicroStrategy ONE

Managing Result Caches

As a system administrator, your greatest concerns about caching are consistency and availability of the cached data. You have the important responsibility of synchronizing the caches with the data in the data warehouse. Therefore, as data changes in the data warehouse, you must ensure that the outdated cached data is either updated or discarded. You can do this in two main ways: Invalidating and Scheduling. These methods, along with other maintenance operations that you can use when managing result caches, are discussed below. They include:

Scheduling Updates of Result Caches

You can schedule a report or document to be executed regularly, to ensure that the result cache is up-to-date. Scheduling is a proactive measure aimed at making sure result caches are readily available when needed.

Typically, reports and documents that are frequently used best qualify for scheduling. Reports and documents that are not frequently used do not necessarily need to be scheduled because the resource cost associated with creating a cache on a schedule might not be worth it. For more information on scheduling a result cache update, see Scheduling Reports and Documents: Subscriptions.

Unloading and Loading Result Caches to Disk

You may need to unload caches from memory to disk to create free memory for other operations on the Intelligence Server machine.

If a report cache is unloaded to disk and a user requests that report, the report is then loaded back into memory automatically. You can also manually load a report cache from the disk into memory.

Caches are saved to disk according to the Backup frequency setting (see Configuring Result Cache Settings). Caches are always saved to disk regardless of whether they are loaded or unloaded; unloading or loading a cache affects only the cache's status in Intelligence Server memory.

Invalidating Result Caches

Invalidating a result cache indicates to Intelligence Server that this cache should not be used. Invalidation is a preventive measure that you can take to ensure that users do not run reports that are based on outdated cached data. Examples of when the data may be outdated include:

  • When the data warehouse changes, the existing caches are no longer valid because the data may be out of date. In this case, future report/document requests should no longer use the caches.
  • When the definition of an application object (such as a report definition, template, filter, and so on) changes, the related result cache is automatically marked as invalid.
  • When the cache for any of the datasets for a document becomes invalidated or deleted, the document cache is automatically invalidated.

Caches need to be invalidated when new data is loaded from the data warehouse so that the outdated cache is not used to fulfill a request. You can invalidate all caches that rely on a specific table in the data warehouse. For example, you could invalidate all report/document caches that use the Sales_Trans table in your data warehouse.

Only Matching and Matching-History caches can be invalidated. Invalidating a cache has the following effects:

  • An invalid Matching cache is automatically deleted.
  • An invalid Matching-History cache is converted to a History cache. If all History messages relating to this cache are deleted, the converted History cache is also deleted.

MicroStrategy strongly recommends that you invalidate Matching and Matching-History caches instead of deleting them directly.

Invalid caches are deleted automatically based on the Cache lookup cleanup frequency setting. For more information about this setting, see Configuring Result Cache Settings.

You can invalidate caches manually or by scheduling the invalidation process.

Invalidating a Cache with a Scheduled Administration Task

You can schedule a MicroStrategy administration task to invalidate caches on a recurring schedule. In the Project Configuration Editor, in the Caches: Result Caches (Maintenance) category, you can select a schedule to be used to invalidate caches. For more information about scheduling tasks, see Scheduling Administrative Tasks.

Invalidating a Cache with a Command Manager Script

You can update the data warehouse load routine to invoke a MicroStrategy Command Manager script to invalidate the appropriate caches. This script is at C:\Program Files (x86)\MicroStrategy\Command Manager\Outlines\Cache_Outlines\Invalidate_Report_Cache_Outline. For more information about Command Manager, see Automating Administrative Tasks with Command Manager.

To invoke Command Manager from the database server, use one of the following commands:

  • SQL Server: exec xp.cmdshell cmdmgr
  • Oracle: host cmdmgr
  • DB2: ! cmdmgr
  • Teradata: os cmdmgr

Invalidating a Cache Manually

From the Cache Monitor, you can manually invalidate one or more caches.

To Manually Invalidate a Cache

  1. In Developer, log in to a project source. You must log in as a user with the Monitor Caches privilege.
  2. Expand Administration, then expand System Monitors, then expand Caches, and then select Reports or Documents.
  3. Select the project for which you want to invalidate a cache and click OK.
  4. Right-click the cache to invalidate and select Invalidate Cache.

Deleting Result Caches

Typically, you do not need to manually delete result caches if you are invalidating caches and managing History List messages. Result caches are automatically deleted by Intelligence Server if cache invalidation and History Lists are performed and maintained properly, as follows:

  • A Matching cache is deleted automatically when it is invalidated.
  • A History cache is deleted automatically when all History List messages that reference it are deleted. MicroStrategy recommends that you actively maintain History List messages, as History caches are deleted automatically.
  • A Matching-History cache is handled in the following way:
    • When all the History List messages that reference a Matching-History cache are deleted, the cache is converted to a Matching cache.
    • When a Matching-History cache is invalidated, it is converted to a History cache.
  • An XML cache is deleted automatically when its associated Matching or History cache is deleted.

In all cases, cache deletion occurs based on the Cache lookup cleanup frequency setting. For more information about this setting, see Configuring Result Cache Settings.

You can manually delete caches via the Cache Monitor and Command Manager, or schedule deletions via the Administration Tasks Scheduling, in the same way that you manually invalidate caches. For details, see Invalidating Result Caches.

Purging all Result Caches in a Project

You can delete all the result caches in a project at once by selecting the Purge Caches option in the Project Configuration Editor. This forces reports executed after the purge to retrieve and display the latest data from the data warehouse.

Purging deletes all result caches in a project, including caches that are still referenced by the History List. Therefore, purge caches only when you are sure that you no longer need to maintain any of the caches in the project, and otherwise delete individual caches.

Even after purging caches, reports and documents may continue to display cached data. This can occur because results may be cached at the object and element levels, in addition to at the report/document level. To ensure that a re-executed report or document displays the most recent data, purge all three caches. For instructions on purging element and object caches, see Deleting All Element Caches and Deleting Object Caches.

To Purge all Result Caches in a Project

  1. In Developer, right-click the project and select Project Configuration Editor.
  2. Expand Caching, then Result Caches, and then select Maintenance.
  3. Click Purge Now.

Expiring Result Caches

Cache expiration is the process of marking a cache out of date. Expiring a cache has the same result as invalidating a cache, and applies to Matching caches and Matching-History caches. The only difference between expiration and invalidation is that expiration happens after a set period of time. For information on how invalidation works, see Invalidating Result Caches.

MicroStrategy strongly recommends that you invalidate a cache when changes in the data from the data warehouse affect the cache, rather than relying on a time interval to expire caches. To disable cache expiration, in the Caching: Result Caches: Maintenance subcategory of the Project Configuration Editor, select the Never expire caches check box.

Cache expiration occurs automatically according to the Cache duration (Hours) setting in the Caching: Result Caches (Maintenance) subcategory in the Project Configuration Editor.

When a cache is updated, the current cache lifetime is used to determine the cache expiration date based on the last update time of the cache. This means that changing the Cache duration (Hours) setting or the Never Expire Caches setting does not affect the expiration date of existing caches. It affects only the new caches that are being or will be created.