Map service GetVirtualCacheDirectory method
Gets the virtual directory containing the cache tiles for a given layer within a map (data frame).
GetVirtualCacheDirectory(string MapName, int LayerID)
Parameter |
Description |
---|---|
MapName |
The name of the map (data frame) on which a cache was created. |
LayerID |
The layer id of the layer in the map on which a cache was created. A multilayer cache will have a different virtual directory for each layer. A fused cache will only have one virtual directory. To get the virtual directory of a fused cache, specify a value of -1. |
Return Value
A string representing the URL to a virtual directory containing cached tile images. If the map or layer does not have a virtual cache directory, the method will return an exception.
Remarks
To determine if you are working with a map service that has a cache, use the IsFixedScaleMap method. To determine if you are working with a multilayer or fused cache, use the methods HasLayerCache or HasSingleFusedCache on the map service proxy.
The virtual directory for a fused cache follows the pattern <base url>\<map name>\_alllayers. For a multilayer cache the pattern is <base url>\<map name>\<layer name>.
Layer names can be retrieved via the MapServerInfo object returned from the GetServerInfo method. Each layer is referenced via a MapLayerInfo object accessible via its MapLayerInfos property.

A map service with a multilayer cache may have a cache generated on some layers and not others.
Examples
C#
MapService_MapServer mapservice = new MapService_MapServer();
mapservice.Url = "http://localhost:6080/arcgis/services/MapFusedCache/MapServer";
string mapname = mapservice.GetDefaultMapName();
// Use -1 for fused caches
string virtualcachedirectory = mapservice.GetVirtualCacheDirectory(mapname, -1);
VB.NET
Dim mapservice As MapService_MapServer = New MapService_MapServer()
mapservice.Url = "http://localhost:6080/arcgis/services/MapFusedCache/MapServer"
Dim mapname As String = mapservice.GetDefaultMapName()
' Use -1 for fused caches
Dim virtualcachedirectory As String = mapservice.GetVirtualCacheDirectory(mapname, -1)
Java
String serviceURL = "http://localhost:6080/arcgis/services/MapService/MapServer";
MapServerBindingStub mapService = new MapServerBindingStub(serviceURL);
String mapName = mapService.getDefaultMapName();
//Use -1 for fused caches
String virtualCacheDirectory = mapService.getVirtualCacheDirectory(mapName, -1);
System.out.println("Virtual Cache Directory: " + virtualCacheDirectory);