Control Data Caching for Business Objects

When application resources don’t include sensitive data, you can define a caching strategy to safely store your business object’s data and improve performance. Caching enables data to be retrieved from the browser cache, instead of the business object on the server, thus speeding up subsequent requests for this data.

Data Caching Options

Caching for each business object is controlled by its data caching strategy. You can choose predefined options (Sensitive, Private, or Public Shared) which combine flags used by the Cache-Control HTTP header to meet common caching scenarios. Or, you can use a combination of Cache-Control flags to build a custom caching strategy.

Here’s a look at the different caching options in VB Studio:

Define a Data Caching Strategy

Configure the Resource Cache Control setting to define a caching strategy that safely stores a business object’s data. Because all application data is deemed sensitive, by default, no data is cached.

Whether you cache data between the server and the browser or not at all depends on factors such as whether your data is sensitive, how often it is updated, and so on. Before you decide on a caching strategy, check whether it is safe to cache your data. If it is, decide on an option that makes the most sense for your data and specifies where, and for how long, the data can be cached. See Data Caching Options.

You can apply a different caching strategy for each business object, but be aware that the strategy applies uniformly to all its endpoints.

  1. Select the business object’s Endpoints tab.

  2. Expand Resource Cache Control and select a suitable Data caching strategy:

    Option Steps
    Sensitive Select Sensitive if your data is sensitive and must never be cached (for example, banking transactions or personally identifiable information). This option is the default setting that disables caching.
    Public shared
    1. Select Public shared if your data isn't sensitive, is not likely to change often (for example, a list of country code values), and can be cached by the browser as well as other intermediary caches.
    2. In the Max Age field, enter how long the data can be cached. To cache your data for, say, a month, enter 2629746 as the max age in seconds. After this duration, the data will be considered stale and if a user is offline, they will continue to see the stale data.

      If you don't want this behavior, use the Custom option and add must-revalidate in addition to max-age. In this case, after the max-age duration, the data must be re-validated or downloaded again from the origin server.

    Private
    1. Select Private if your data is user-specific (for example, someone's purchase order history that must not be in public caches but can be stored in the client's browser cache).
    2. In the Max Age field, enter how long the data can be cached. To cache your data for, say, 24 hours, enter 89999 as the max age in seconds. After this duration, the data will be considered stale and if a user is offline, they will continue to see the stale data.

      If you don't want this behavior, use the Custom option and add must-revalidate in addition to max-age. In this case, after the max-age duration, the data must be re-validated or downloaded again from the origin server.

    Custom
    1. Select Custom to build your own caching strategy.
    2. Select one or more of the available flags: no-cache, public, private, no-store, must-revalidate, and max-age.
    3. If you chose max-age, enter a value in the Max age field.

Note:

Custom settings are not validated. It is your responsibility to ensure the flags you select are valid combinations. </div> </td> </tr> </tbody> </table>

Your caching strategy is applied to data requests at runtime, when your web server adds the Cache-Control header to each endpoint response.

Note: You can see your caching setting take effect only when an application is shared or published, not when you preview the application during development.