Skip to main content

Configuring content cache-controls

With content cache-controls, you can modify the cache behavior of the browser. The cache-control is used on endpoints handled by the repository service. This functionality is disabled by default and can be enabled by modifying the files Repository.exe.conf and capabilities.json, followed by a restart of the Qlik Sense Service Dispatcher and the Qlik Sense Repository Service.

Do the following:

  1. Open C:\Program Files\Qlik\Sense\Repository\Repository.exe.conf and set the following key to true:

    <add key="ContentCacheControl" value="true" />

  2. Open C:\Program Files\Qlik\Sense\CapabilityService\capabilities.json and add the following flag:

    {"contentHash":"2ae4a99c9f17ab76e1eeb27bc4211874","originalClassName":"FeatureToggle","flag":"QMC_CONTENT_CACHE_CONTROL","enabled":true}

Content cache-controls are added or modified in the Content library associated items section in the Qlik Management Console (QMC), see Content library: associated items. Once configured, content cache-controls are automatically associated with a particular content library and will only affect requests targeting its content. To create content cache-controls targeting other requests, so-called general content cache-controls, the reference to the content library needs to be removed. You do this by setting the contentLibrary value to null, using the available API PUT method, see the following example. Content cache-controls can also be created directly through an API request by using the POST method.

PUT /qrs/contentcachecontrol/33774a23-ad86-44f7-96bc-0e346c062cc2
{
  "id": "33774a23-ad86-44f7-96bc-0e346c062cc2",
  "createdDate": "2021-12-09T11:59:20.728Z",
  "modifiedDate": "2021-12-09T11:59:20.728Z",
  "modifiedByUserName": "RDLUND\\svc-silver",
  "name": "api",
  "contentLibrary": null,
  "filter": "test",
  "maxAge": 3600,
  "cachePolicy": 0,
  "privileges": null,
  "schemaPath": "ContentCacheControl"
}

Requests to fall under defined content cache-control are filtered based on the value of the user-defined regular expression - regex filter as seen in the QMC, or filter filed as seen in the ContentCacheControl model, see Content library: associated items for examples. Part of the URI's request evaluated consists of the text after the hostname, not including the virtual proxy's prefix. Content library controls associated with content libraries take precedence over the general ones when the Qlik Sense Repository Service is looking for a match. They are implemented in stack, meaning that the first match terminates further lookup. When several controls match the user-defined filter, the match with the latest modified date - modifiedDate takes precedence. With the default security rules set, only the RootAdmin role has full CRUD access to content cache-controls. In addition ContentAdmin and SecurityAdmin roles have Read access to all content cache-controls. Users with Read privilege on corresponding content libraries have Read access to content cache-controls associated with those content libraries, see the ReadContentCacheControl rule in Security rules included in Qlik Sense .

Content cache-controls for hub specific requests that include api in the URI are fetched on startup of the Hub service. For newly added or modified content cache-controls, targeting those requests to apply, a restart of the Hub service is required by restarting Qlik Sense Service Dispatcher, or by terminating the corresponding node.js process - "..\HubService\index.js. For other types of requests, no restart is required after creating a new entry or modifying an existing one.

For new methods as per Open API specification for Repository Main API, see: Contentcachecontrol.

For corresponding models as per Open API specification for Repository Main API, see: ContentCacheControl and ContentCacheControlCondensed.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!