Dear All,
I am trying to use system.util.globals as in-memory cache provider because it takes time to get data from Database, the issue I found that it's even running slower than without system.util.globals support.
#cacheProvider = {}
cacheProvider = system.util.globals
def getCache():
if not GLOBAL_CACHE_ENABLED:
return None
if cacheProvider.get(CACHE_ROOT_KEY) is None:
cacheProvider[CACHE_ROOT_KEY] = {}
return cacheProvider.get(CACHE_ROOT_KEY)
Any recommendations what we could use it properly? or any other in-memory cache alternative providers?
Below is description of getGlobals()
system.util.getGlobals | Ignition User Manual (inductiveautomation.com)
Description
This method returns a dictionary that provides access to the legacy global namespace. As of version 7.7.0, most new scripts use the modern style of scoping, which makes the 'global' keyword act very differently. Most importantly, the modern scoping rules mean that variables declared as 'global' are only global within that one module. The system.util.getGlobals() method can be used to interact with older scripts that used the old meaning of the 'global' keyword.
New in 8.1.0
The globals dictionary now persists across the lifetime of the JVM, and is accessible at system.util.globals. This means system.util.globals will work as an alternative to system.util.getGlobals. However, system.util.getGlobals is still the only option that will appear in the Designer's autocomplete feature.