As we talk before, AX has no support with sigleton instance modle, but we can use the global cache insteaded.
1、Create the global cache.
1 SysGlobalCache globalCache; 2 ; 3 4 globalCache = ClassFactory.globalCache(); //全局缓存,客户端和服务端都可以用,但依赖调用方 5 globalCache = Appl.globalCache(); //全局缓存,客户端和服务端都可以用,但依赖调用方 6 globalCache = infolog.globalCache(); //全局缓存,客户端和服务端都可以用,建议使用这种缓存 7 globalCache.set("Owner", [key], "Value");
2、Get the global cache value.
1 SysGlobalCache globalCache; 2 ; 3 4 globalCache = infolog.globalCache(); 5 print globalCache.get("Owner", [Key]); //获取缓存值,根据缓存所有者、键值获取值 6 globalcache.remove("Owner", [Key]); //清除缓存