What is a feature cache?
The feature cache is a local copy of data used to improve query performance for web feature layers. The feature cache stores an exact copy of data in a local data store so that queries can take place locally instead of across the web. When the cache is in use, all spatial queries executed against the web feature layer are redirected to and returned from the feature cache. The feature cache supports four major operations. The cache can be enabled or disabled, and it can be filled or cleared. This topic explains how and when these operations take place and how they can be controlled.
Fill the feature cache
The feature cache must be filled before it can be used. Filling the cache is the act of writing data to the local data store. In ArcGIS Pro, when a view (map or scene) finishes drawing, a background process starts filling the cache. The cache is filled based on the current display extent and with the full resolution geometry and attributes from the layer. Once the cache is filled, all spatial queries within the cached extent will use the cache instead of going to the server. As a view is panned or zoomed (and drawing completes), additional extents will be added to the cache which will subsequently be used for spatial queries. Visibility and visibility ranges that are set on layers are honored by the feature cache. This means that if a layer is turned off in the Contents pane, it will not be cached. Also, if zoomed in or out beyond a layer's visibility range, there will be no attempt to cache the layer (until it is visible again).
Once an extent has been cached for a layer, it is used for the duration of the session. The cache can therefore become stale if there are edits happening outside of your session. For highly dynamic layers, the cache can be disabled or cleared accordingly to ensure that the most up-to-date data is always displayed. The lifetime of the feature cache is dependent on the ArcGIS Pro session, when the session ends, the feature cache is deleted.
In some cases, to avoid performance issues and network activity associated with caching large volumes of data ArcGIS Pro will not cache data. This behavior is enforced per layer when the number of features within the cache extent for that layer is greater than 25 times the value specified in the maxRecordCount property for the layers' service. This means that some layers may not get cached until zoomed in to a more appropriate scale.
Manage the feature cache
To determine the status of the feature cache, complete the following steps:
- In the Contents pane, click List By Data Source .
- Right-click the server corresponding to your web feature layer.
- In the context menu, there are options to enable, disable or clear the feature cache.
- If the cache is enabled, the Enable Cache option will be unavailable. Click Disable Cache or Clear Cache to disable or clear the feature cache.
- If the cache is disabled, the Disable Cache option and Clear Cache option will be unavailable. Click Enable Cache to enable feature caching.
- If the cache has been recently cleared, the Enable Cache option and Clear Cache option will be unavailable. Click Disable Cache to disable feature caching.
Work with the feature cache
The three options mentioned above are available for managing the feature cache. Note that each web feature layer has its own source, and its cache is managed individually. This means that enabling or disabling the cache for one web feature layer affects only its sublayers, and does not affect other web feature layers that have a different source.
The enabled and disabled settings are honored when saving projects, so if a feature layer is saved with caching disabled, it remains disabled when the project is reopened. Since the cache is always deleted at the end of a session, a newly opened project always has cleared caches, which are subsequently filled when the display finishes drawing.
It is recommended that the feature cache be enabled whenever snapping is going to be performed against a web feature layer. The feature cache can be disabled when working with highly dynamic feature layers and a stale cache is not acceptable. Disabling the feature cache ensures that the most current data is always used for display and query purposes. The disable and enable status of a data source is stored per view. This means that if the same feature layer is added to multiple views, it can be enabled in some views and disabled in others. Disabling the cache does not clear the local data from disk; rather, the local cache is ignored. When a disabled cache is enabled, the previously cached data is reused.
Clearing the feature cache can be done periodically if there are edits made to the underlying web feature layer from other sources. This is essentially a manual refresh of a stale cache. Note that unlike the enabling and disabling of feature caching, when the cache is cleared, it is cleared for all the web feature layers in all views, not just the active view.
When edits are performed, they are written to the feature cache as well as the underlying web feature layer and should be visible in all maps that are using the web feature layer regardless of their feature cache status.
For more information about working with feature services in ArcGIS Pro, see Use web feature layers.