--- title: "system.db.clearNamedQueryCache.md" description: "This clears the cache of a Named Query." --- # system.db.clearNamedQueryCache.md > This clears the cache of a Named Query. This function is used in **Python Scripting**. ## Description This clears the cache of a Named Query. If called from the Shared Scope (i.e., Tag Event Scripts, Alarm Pipelines, etc.) then the name of the project must be passed as a parameter. ## Client Permission Restrictions This scripting function has no [Client Permission](projects\project-properties\project-properties.md#client---permissions) restrictions. ## Syntax - Project Scope `system.db. clearNamedQueryCache(path)` ### Parameters Type | Parameter | Description ------- | ------- | ------ String | `path` | The Path to the named query we want to clear the cache of. ### Returns No Return Value ### Scope All ## Syntax - Shared Scope `system.db. clearNamedQueryCache(project, path)` ### Parameters Type | Parameter | Description ------- | ------- | ------ String | `project` | The Project that contains the named query whose cache needs to be cleared. String | `path` | The Path to the named query we want to clear the cache of. ### Returns No Return Value ### Scope All ## Code Examples ```python title="Example #1" # Calling this simply clears all Named Query Caches. # This example is being called from the Shared Scope. If called from the Project Scope, the projectName parameter should be omitted. projectName = "myProject" namedQueryPath = "folder/selectFromInventory" system.db.clearNamedQueryCache(projectName, namedQueryPath) ``` ```python title="Example #2" # If the same Named Queried is called multiple times with different parameters in a single script, then we can clear the caches once we're done with the following. # This example assumes the script is running in the Project Scope. If called from the Shared Scope, the name of the project would need to be included. namedQueryPath = "myUpdateQuery" # This creates one cache. params = {"param1":"A"} system.db.runNamedQuery(namedQueryPath, params) # This creates a separate cache. params = {"param1":"B"} system.db.runNamedQuery(namedQueryPath, params) # Clear all of the caches from the specified Named Query. Note that all caches are cleared, including those generated from elsewhere on the Gateway. system.db.clearNamedQueryCache(namedQueryPath) ```