ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Clear Workspace Cache

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Clears any enterprise geodatabase workspaces from the enterprise geodatabase workspace cache.

Usage

  • This tool only works with enterprise geodatabase workspaces.

  • This tool can be used to help disconnect idle enterprise geodatabase connections in a long-running application.

  • If you run the tool without specifying an Input data element, all enterprise geodatabase workspaces in the enterprise geodatabase workspace cache will be cleared. Specify the specific .sde file associated with the workspace you want to clear in order to clear a specific enterprise geodatabase workspace.

  • Note:
    Clearing an enterprise geodatabase workspace from the enterprise geodatabase workspace cache does not guarantee the connection to the enterprise geodatabase server will be disconnected. It will only ensure the geoprocessor object no longer has any hold on the enterprise geodatabase workspace that has been cleared. If any other process has references to this enterprise geodatabase workspace the connection will be maintained.
    • To clear the workspace cache correctly in ArcCatalog: After using this tool in ArcCatalog you will have to navigate to a different folder in the Table of Contents and refresh before the enterprise geodatabase connection will be disconnected.
    • To clear the workspace cache correctly in ArcMap: Remove all references to data in ArcMap that may be accessing the enterprise geodatabase workspace and then run the ClearWorkspaceCache() tool to ensure the connection is disconnected.
    • To clear the workspace cache correctly in a script: The call to ClearWorkspaceCache() should be the last call in your script making sure to remove all references to any objects that may be pointing to the enterprise geodatabase workspace before making the call to ClearWorkspaceCache().

Syntax

arcpy.management.ClearWorkspaceCache({in_data})
ParameterExplanationData Type
in_data
(Optional)

The enterprise geodatabase database connection file representing the enterprise geodatabase workspace to be removed from the cache. Specify the path to the enterprise geodatabase connection file that was used in running your geoprocessing tools in order to remove the specific enterprise geodatabase workspace from the cache. Passing no input parameter will clear all enterprise geodatabase workspaces from the cache.

Data Element; Layer

Derived Output

NameExplanationData Type
out_results

Whether the operation was successful.

Boolean

Code sample

ClearWorkspaceCache example (Python window)

The following Python window script demonstrates how to use the ClearWorkspaceCache function in immediate mode.

import arcpy
arcpy.env.workspace = "c:/connectionFiles/Connection to gpserver.sde"
arcpy.ClearWorkspaceCache_management()

Environments

  • Current Workspace

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics

  • An overview of the Workspace toolset

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal