There are three way to cache objects.
A global cache is an instance of class - SysGlobalCache, which is nothing but a Map containing Maps with a Key. These Maps contain the actual value and a key.
In Ax, we have three Global Cache Classes
1.Infolog.globalCache()
2.Appl.globalCache()
3. ClassFactory.GlobalCache().
How to use:
static void GlobalCacheSetAndGet(Args _args)
{
SysGlobalCache globalCache;
class test;
;
globalCache = infolog.globalCache();
if (globalCache.isSet(classstr(test), 0))
{
test= globalCache.get(classstr(Test), 0);
return test;
}
else
{
test= new test();
globalCache.set(classstr(Test), 0, test);
return test;
}
}
No comments:
Post a Comment