When you create a map cache, you are creating a snapshot, or picture, of your map at the time you create the cache. When you edit or update the data, two things need to happen before others can see the changes:
- You have to update the cache.
- People who have used the cache need to delete any outdated tiles that may be stored on their machines. This is clearing the cache.
Updating your cache
Updating the cache involves re-creating some or all of the tiles in your cache. You can update the cache using the Manage Map Server Cache Tiles tool. In the tool dialog box, set the Update Mode parameter to Recreate All Tiles.
If you want to update tiles in a certain rectangular area of the map, you can change the default for Update Extent, which is the extent of the entire service.
If you know that features in only one dataset or one geographic area have changed, you can supply the path to a feature class or a graphic that you draw in ArcMap for the Area of interest property. With this option, the tool re-creates only the tiles that cover the area of interest. This works well if you've edited polygon data. For example, if you have a cache covering the entire United States and you just edited the national park boundaries, you can supply the national parks feature class as the area of interest. Only tiles in the national parks are re-created.
Filling in empty tiles
If you want to complete a partially created cache or perform a quality check on your cache, run Manage Map Server Cache Tiles with Update Mode set to Recreate Empty Tiles. This setting checks the folders of your cache and creates any tiles that are missing. As with the other update modes, you can set a rectangular extent or a feature class as boundaries for creating empty tiles.
In the image below, all tiles outlined in blue would be created using Recreate Empty Tiles.
Be aware that Recreate Empty Tiles can take a long time to run, since each tile must be checked.
In some situations, you might want to delete certain areas of tiles or even remove the entire cache.
- To delete a specific area of tiles, run the Manage Map Server Cache Tiles tool with Update Mode set to Delete Tiles. Before executing the tool, set Update Extent to the area that you want to delete. You can alternatively specify a feature class to spatially designate which tiles will be deleted from the cache.
- To delete the entire cache, run the Delete Map Server Cache tool, which removes all tiles and folders associated with the cache. Ensure that the maximum number of instances of the CacheTools geoprocessing service is set to at least a value of 3 before you run this tool.
Changing the scales in your cache
If you want to add or remove scales from your cache tiling scheme, use the Manage Map Server Cache Scales tool. This tool allows you to choose a map service and redefine its set of scales, adding or deleting scales as necessary. When you specify the scale levels in this tool, make sure you include the full list of scales that you want; any scales not appearing in the list are deleted.
Scripting update tools
You can run Manage Map Server Cache Tiles automatically on a regular basis through scripting. This is useful if you have editors that are constantly updating the data. For further information and examples of how to automate your cache updates, see Automating cache creation and updates with geoprocessing.
Clearing local caches on the client
When displaying cached map services, ArcGIS clients store tiles locally so that they don't have to be retrieved again when the user navigates back to the area. Even when you've updated your cache, people who have used your cache before may have some of the tiles stored locally on their machines. They need to clear their cache to see your changes.
If you frequently update your cache, consider disabling the option for clients to cache tiles locally. This way, you know that those who use your cache will always see the most up-to-date tiles instead of older tiles that might be stored on their machines.
If you have not disabled local caching on the client, users of your cache can choose whether to cache tiles locally or not. They can choose to continually build the local cache, build a new local cache for each application session, or build no local cache at all.
Dedicating server resources to the update
Updating a cache uses server resources because the server is required to continually draw map tiles during the update. You don't want your production server to be maxed out creating map tiles when it needs to be filling client requests. The most scalable solution is to perform the update on a staging server, then copy the updated tiles to your production server.
If a staging server is not available, the next best option is to perform your update during periods of low traffic, such as on nights or weekends. If you still don't want your entire set of CPU resources dedicated to the update, you can lower the number of service instances that the CachingTools geoprocessing service is allowed to use, either at the service level (specified in the Service Editor) or at the job level (specified when you run the tool). A final option is to assign the CachingTools geoprocessing service to run in its own cluster separate from the map service, thereby ensuring that CachingTools will not use resources on the machine where the map service is running.
Use operating system performance monitoring tools, such as Windows Task Manager or Windows Performance Monitor, to ensure that your CPU is not being completely utilized by running service instances during the cache update.
Note that lowering the number of instances allowed to work on an update causes the update to take longer. If you are short on hardware, you may have to make a decision that sacrifices cache availability for cache update speed, or vice versa.