Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

Applying a custom cache control policy in Qlik Sense Enterprise on Windows

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Vicky_Z
Support
Support

Applying a custom cache control policy in Qlik Sense Enterprise on Windows

Last Update:

Jan 4, 2023 7:28:32 AM

Updated By:

Sonja_Bauernfeind

Created date:

Jan 4, 2023 7:25:19 AM

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.

Cache-control for endpoints handled by the repository service was introduced in Qlik Sense Enterprise on Windows February 2022 (Patch 1). In the May 2022 release further enhancements were made to extend caching policies for requests specific to the Hub service. Upgrade Qlik Sense to make use of the new features. 

In this article, we walk you through modifying the cache control policy and how to apply it globally across your Qlik Sense Enterprise on Windows environment. 

Before modifying the cache-controls

Please note the following before modifying cache control headers:

  • It is generally not recommended to manually alter the cache-control headers.
  • Make sure that you understand how the browser caching behavior is affected by the changes.
  • Prior to applying any changes in a production environment, evaluate the risks of the changes.

Enable the feature

The feature is disabled by default.  For details, see Configuring content cache-control.

  1. Open C:\Program Files\Qlik\Sense\Repository\Repository.exe.conf

  2. Modify the following key and set it to true:

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

    Save the file.

  3. Open C:\Program Files\Qlik\Sense\CapabilityService\capabilities.json

  4. Add the following flag:

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

    Save the file.

  5. Restart the Qlik Sense Repository Service and Qlik Sense Dispatcher Service

 

Modify cache-controls in the Qlik Sense Management Console

  1. After enabling cache-control, open the Qlik Sense Management Console
  2. Go to Content Libraries

    Content libraries.png

  3. Open the Content Library you wish to configure

    open a content library.png

  4. In the Associated Items menu, select Content cache-controls
  5. Click Link new content cache control

    associated items.png

  6. Configure the cache-controls as per Content cache-controls  and click Add

    The cache control will automatically be linked.

    add content cache control.png

  7. Restart the Qlik Sense Service Dispatcher and Qlik Sense Repository Service

These are the predefined cache-control header values:

"CachePolicyEnum": {
    "values": [
        "0: Normal", -> public, max-age=3600
        "1: MustRevalidate", -> public, must-revalidate, max-age=0
        "2: PrivateNormal", -> private, max-age=3600
        "3: PrivateMustRevalidate", -> private, must-revalidate, max-age=0
        "4: NoStore" -> no-store
    ]
}

 

To modify the cache-control policy on a global level

You can create a global cache control policy (not tied to a content library) by using either the API or an SQL query against the QRS database. A restart of the Qlik Sense Service Dispatcher and Qlik Sense Repository service is required after.

API example:

POST /qrs/ContentCacheControl
{
    "id": "e07ca071-7d72-417d-93c2-d60687f747a8",
    "name": "api",
    "contentLibrary": null,
    "filter": "api",
    "maxAge": 3600,
    "cachePolicy": 4,
    "privileges": null
}

 

Database Query example:
INSERT INTO public."ContentCacheControls" ("ID", "CreatedDate", "ModifiedDate", "ModifiedByUserName", "Name", "Filter", "MaxAge", "CachePolicy", "ContentLibrary_ID")
VALUES ('e07ca071-7d72-417d-93c2-d60687f747a8', '2022-08-19 14:28:48.077709', '2022-08-19 14:28:48.077709', 'RDLUND\svc-silver', 'api', 'api', 3600, 4, null);
  • Please update the values of "CreatedDate", "ModifiedDate", "ModifiedByUserName" keys and keep the rest of them unchanged. The ID can be any unique quid value.
  • Please modify the value of "Filter" to a customised filter by using regex as per Content cache-controls.

 

The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.

 

Related Content 

What's new in Qlik Sense February 2022 
What's new in Qlik Sense May 2022 


Environment

Qlik Sense Enterprise on Windows 

 

Internal Investigation ID(s):

QB-11410

Labels (1)
Comments
jpbartolomeo1
Partner - Contributor
Partner - Contributor

Thanks. Great post!

I see that there are only 4 policies, but I need to create a global Cache-Control with the following information:

Cache-Control: no-store, no-cache, max-age=0

Is there a way to create it?

Thanks!

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @jpbartolomeo1 

I have not been able to verify if this is possible. But before I send you over to create an idea (which may be necessary), let me check with our product team and get back to you.

All the best,
Sonja 

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @jpbartolomeo1 

As a follow-up. Using policy 4 (no store) will serve the purpose you are going for with no-store, no-cache, max-age=0 without needing no-cache and max-age=0 as it will simply use no-store to achieve both.

To explain:

max-age=0 forces the response to be validated again. It is also a legacy setting meant for implementations which do not support no-cache. 
no-cache forces the response to be validated again, but if you are aiming to prevent the cache from storing responses entirely, no-store is recommended. 

All the best,
Sonja

 

jpbartolomeo1
Partner - Contributor
Partner - Contributor

Thanks for your answer, Sonja!

I will use the no-store then. 

I have to change all the cache policies for Qlik (hub, qmc, api), so I used the filter (.*?). This was a requirement from the client's Security team.

The PoC is working great: I receive the correct header in the HTTP response.

I have to do a  document explaining before they do it explaining also the impact.

I know this only disables the browser cache to avoid confidential data storage.

Is there any possible problem we can have with the clients connecting to Qlik? Any negative impact that can result for this change? I can't find more info.

Thanks!

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @jpbartolomeo1 

The impact would be the same as for any other platform where caching is disabled: every access will lead to the content being reloaded (newly requested). No other impact unique to Qlik is known. This does not apply to our in-memory engine. It will not affect the performance of the app's calculations and fetching of selections.

All the best,
Sonja 

jpbartolomeo1
Partner - Contributor
Partner - Contributor

Thanks! 🙂

Version history
Last update:
‎2023-01-04 10:28 AM
Updated by: