ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / LayerCacheType Enumeration
Example Example

In This Topic
    LayerCacheType Enumeration
    In This Topic
    Layer cache type. Use with Layer.SetCacheOptions to control layer caching options.
    Syntax
    Members
    MemberDescription
    MaxAgeCache will be kept between sessions and cleared every Layer.MaxDisplayCacheAge minutes. Use SetDisplayCacheMaxAge to set the cache age. Not supported for layers that support feature caching (i.e. feature service layers).
    None Don't cache the layer locally. If the layer supports feature caching (i.e. is a feature service layer), then any existing cache is also cleared.
    Permanent Cache will be kept between sessions and invalidated when the data is updated. Not supported for layers that support feature caching (i.e. feature service layers).
    Session Cache will be cleared when the session ends.
    Example
    Set the layer cache
    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));
    });
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Desktop.Mapping.LayerCacheType

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also