Manage CDN caching

The Cache Control setting for a hosted feature layer (item) allows you to optimize the number of query requests that are directed to a feature layer in a feature service. Using the CDN cache can significantly decrease network latency and improve performance when there are high demands on feature services at global scales.

Item page service
Hosted feature layer item page in your portal showing feature layer settings.

What is the CDN cache?

The CDN cache is a content delivery network (CDN) supported by ArcGIS Location Platform and ArcGIS Online that is designed to optimize service performance and reduce service requests. To use the CDN cache with ArcGIS Location Platform, the feature layer sharing level must be Owner (private). To use the CDN cache with ArcGIS Online, the sharing level must be Everyone (public).

How the CDN cache works

Applications make query requests to a feature layer in a feature service when you display a map with the layer, interact with the map (and layer), or make queries directly to the layer. The CDN caches the data returned from the service for requests for a length of time (cacheMaxAge) that you specify in the setting. The default value is 30 seconds. Therefore, when the same requests are made to the service within that time, the CDN cache can provide the response. Once the maximum cache age is reached, the cache is refreshed and the data is synchronized with the service. This ensures the cache stays up to date when the data is being updated by your application or other applications.

If the data is not being updated frequently, you should set the cache timeout to the longest setting possible (1hr). If it is being edited frequently, set the interval to be slightly higher than the time interval the data is being edited. The longer the cache timeout, the better the overall performance will be.

How to manage CDN cache settings

The steps to manage service settings are:

  1. Sign into a data management tool with your ArcGIS account:

    • Go to ArcGIS.com and sign in to your portal (ArcGIS Location Platform or ArcGIS Online)
  2. Find the item.
  3. Use the settings tab of the item page to change the cache control settings.

Code examples

You can use data management tools to manage the CDN cache settings of a hosted feature layer or you can use the ArcGIS REST APIs. The following examples illustrate how to programmatically set the cache max age of a hosted feature layer.

Set the cache max age

This example uses the updateDefinition admin operation to set the cacheMaxAge with a value in seconds between zero and one hour (3600).

Request

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
POST https://{host}/rest/admin/services/{service_name}/FeatureServer/updateDefinition HTTP/1.1

f=json
&token={access_token}
&updateDefinition = "{
    "hasStaticData": false,
    "capabilities": "Query,Editing,Create,Update,Delete",
    "layerOverridesEnabled":true,
    "editorTrackingInfo": {
        "enableEditorTracking":false,
        "enableOwnershipAccessControl": false,
        "allowOthersToUpdate": true,
        "allowOthersToQuery": true,
        "allowAnonymousToQuery": true,
        "allowAnaonymousToDelete": true
    },
    "cacheMaxAge:3600"
}"

Response (JSON)

Use dark colors for code blocksCopy
1
{"success":true}

Tutorials

Import data to create a feature layer

Use data management tools to import files and create a feature layer in a feature service.


Define a new feature layer

Use data management tools to define and create a new empty feature layer in a feature service.


Manage a feature layer

Use a hosted feature layer item to set the properties and settings of a feature layer in a feature service.


Create a vector tile service

Use data management tools to create a new vector tile service from a feature service.


Create a map tile service

Use ArcGIS Online or scripting APIs to publish a map tile service.


Workflows

Services

API support

Use data management tools or Client APIs to create, manage, and access data services. The table below outlines the level of support for each API.

CreateManageAccess
ArcGIS Maps SDK for JavaScript1
ArcGIS Maps SDK for Kotlin1
ArcGIS Maps SDK for Swift1
ArcGIS Maps SDK for Flutter1
ArcGIS Maps SDK for Java1
ArcGIS Maps SDK for .NET1
ArcGIS Maps SDK for Qt1
ArcGIS API for Python
ArcGIS REST JS
Esri Leaflet2
MapLibre GL JS23
OpenLayers23
Full supportPartial supportNo support
  • 1. Use portal class and direct REST API requests
  • 2. Access via ArcGIS REST JS
  • 3. Requires manually setting styles for renderers

Tools

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.