Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


New_in
Version7.9.6

 


Scripting_function



Panel
titleDescription

This clears the caches of all named queries Named Queries in a project. 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.


Panel
titleClient Permission Restrictions

This scripting function has no Client Permission restrictions.


Panel
titleSyntax - Project Scope

system.db. clearAllNamedQueryCaches()

  • Parameters

none

  • Returns

No Return Value

  • Scope

All


Panel
titleSyntax - Shared Scope

system.db. clearAllNamedQueryCaches()

  • Parameters

String project The Project that contains the named query whose cache needs to be cleared.

  • Returns

No Return Value

  • Scope

All



Panel
titleCode Examples


Code Block
languagepy
titleSimple Example
# Calling this simply clears all Named Query Caches. 
# This is assumed to run in the Shared Scope, so the name of the project must be included.
system.db.clearAllNamedQueryCaches("myProjectName")


Code Block
languagepy
titleExample - Clear Custom NQ Calls
# If multiple Named Queries with varying parameters are called in a single script, then clearAllNamedQueryCaches can be used to free up the memory used by all of the newly created caches. 
# This example is assumed to run in the Project Scope, so the project parameter may be omitted. 

# This creates one cache.
params = {"param1":"A"}
system.db.runNamedQuery("myUpdateQuery", params)

# This creates a separate cache.
params = {"param1":"B"}
system.db.runNamedQuery("anotherUpdateQuery", params)

# Clear all of the caches from the current project. Note that all caches are cleared, including those generated from elsewhere on the Gateway. 
system.db.clearAllNamedQueryCaches()