public void SetCacheOptions( LayerCacheType cacheType )
Public Sub SetCacheOptions( _ ByVal cacheType As LayerCacheType _ )
Parameters
- cacheType
- The cache type.
public void SetCacheOptions( LayerCacheType cacheType )
Public Sub SetCacheOptions( _ ByVal cacheType As LayerCacheType _ )
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
Refer to the Pro help for more information on caching: How caching works.
Note: for feature services only ArcGIS.Core.CIM.DisplayCacheType.InSession and ArcGIS.Core.CIM.DisplayCacheType.None are supported. For branch versioned feature services, caching is managed by the application automatically and is set to DisplayCacheType.InSession.
Attempting to set a cache type on a layer that is not supported is ignored. Note: If setting LayerCacheType.MaxAge, call SetDisplayCacheMaxAge to set the duration otherwise it uses the default value that is 5.0 minutes.
var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(); ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { // change the layer cache type to maximum age //At 2.x - featureLayer.SetDisplayCacheType(ArcGIS.Core.CIM.DisplayCacheType.MaxAge); featureLayer.SetCacheOptions(LayerCacheType.MaxAge); // change from the default 5 min to 2 min featureLayer.SetDisplayCacheMaxAge(TimeSpan.FromMinutes(2)); });
Target Platforms: Windows 11, Windows 10