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.
- Sensitive: Indicates that data must never be stored in any cache (private or otherwise). Select this option if your business object contains sensitive data, for example, banking transactions or personally identifiable information, that must not be cached and you want the latest most up-to-date information to be served every time.
The Sensitive option is a combination of the no-cache, no-store, and must-revalidate flags that guarantee data is never cached. When a request is made for the data, the browser always checks with the server for the latest data.
- Public Shared: Indicates that data can be cached by the client's browser and other caches (like those from ISPs or other parties) for a specified duration. While this option is the least secure of all the available policies, select this one if your data is not sensitive and is not likely to change often, for example, country codes.
The Public Shared option is a combination of the public and max-age flags that allow data to be stored in any cache for a maximum length of time.
- Private: Indicates that data can be cached, but only by the client's browser for a specified duration. Select this option if your data is user-specific, for example, a user's purchase order history that must not be stored in public caches but can stay in the client's browser cache. Remember though that anybody with access to the client would have access to the data as well.
The Private option is a combination of the private and max-age flags that allow data to be stored only by the client's browser for a maximum length of time.
- Custom: (For advanced users) Specifies a custom option based on the no-cache, public, or private flags, each of which can be augmented by the no-store, must-revalidate, and max-age flags. Custom settings are not validated; select this option only if you are familiar with the Cache-Control header options and are confident of your choices.
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.
Note:
You can see your caching setting take effect only when an application is staged or published, not when you preview the application during development.