Control cache age

When you add one of the following items to Map Viewer, ArcGIS Online uses a content delivery network (CDN) to optimize the map layer's performance and reduce server load through caching if the item is shared with the public:

Caching is the process of storing a copy of a server response so that future requests for the same data can be served more quickly without querying the server again when you use the layers.

As you pan and zoom in the map and interact with the layer, the app requests data. The CDN caches the information returned from the server for each unique request. When the same user or other users issue the exact same request, the information is queried from the cache rather than sending the request to the server. This decreases the amount of time it takes to load a map containing the layer, improves responsiveness of apps that use the layer, which leads to a better experience when interacting with the layer.

The data in the map layer can change on the server, so the CDN and your browser check for updates periodically. The amount of time, in minutes, between these checks is referred to as the maximum cache age. When the maximum cache age is reached, the cache is refreshed. Fewer checks for updates means improved performance; however, it also means people who are using the layer in a map wait longer to see the latest data.

You can increase the maximum cache age setting for these layer items, which decreases the frequency with which the browser and CDN check for changes.

Before increasing the maximum cache age on a layer item, consider the following:

  • Changes to the data may not be publicly available until after the current CDN cache expires. For example, if you increase the maximum cache age for a hosted feature layer from 30 seconds to 5 minutes, the CDN waits 5 minutes before a request prompts it to check for updated data.
  • If you stop sharing the item with the public, cached responses temporarily remain on the CDN until the cache expires. This means if the maximum cache age is set to 5 minutes, it can take up to 5 minutes before the layer is inaccessible to the public. Users signed in to the organization see the latest data, however.

To change the maximum cache age for qualifying items, complete the following steps:

  1. Sign in to your organization.

    You must be the item owner or a member of the default administrator role or a custom role assigned the set of privileges to manage all content owned by organization members.

  2. Open the item page for the layer item.
  3. Click the Settings tab.
  4. Scroll to the Cache control section, and choose the maximum amount of time that the users using the layer have to wait before they receive updates to the data.

    This setting is not available for hosted feature layers that have editing enabled and is not available for secure ArcGIS Server feature services for which credentials are not stored.