Axaptapedia is now maintained by AgileCadence For more information please click here.
The SysGlobalCache class is used by Axapta to store "global" variables and object references. It is implemented as a standard class in the AOT and uses a simple caching mechanism involving nested Map types.
It is possible to create and use SysGlobalCache objects to implement your own local caching, or to use the instances automatically available through infolog.globalCache() (client-side) and appl.globalCache() (server-side).
Cache owner and element keys are always specified as strings. The cached data itself can be of any type, including object references.
Each owner has a separate cache map in the object containing all key/value pairs for that owner. A parent map is used to hold the individual cache maps for each owner, using the owner string as the key.
see also Singleton pattern
public static SysGlobalCache construct()
Create a new instance on the current tier
public boolean clear(str owner)
Clear all cache entries for a specified owner
public int elements(str owner)
Returns the number of cached data elements for the specified owner
public boolean remove(str owner, anytype key)
Remove the cache entry for key, for the specified owner
public boolean set(str owner, anytype key, anytype value)
Set a cache entry for the specified owner. The cache enty is keyed by key and the data to be cached is passed in value
public anytype get(str owner, anytype key, anyType returnValue = )
Return a cached value from the specified owner, using key as the key. If the data is not found, then returnValue will be returned.
public boolean isSet(str owner, anytype key)
Returns true if a particular owner/key combination exists in the cache.
Each instance of SysGlobalCache will run either client-side, or server-side. A client-side cache (such as that available through infolog.globalCache() will not be accessible from server-side code. Users of the caching mechanism must manually synchronise cache contents if they wish the same data to be available from either tier. See the Singleton pattern for an example of this.
The server-side cache is not truly global, as each instance of the cache can only be seen by the individual client which created/accessed it. Therefore it is not possible to use the server-side cache to share data between clients. On a related note, AOSs operating in a cluster each maintain a separate caches and cannot access the cached data from each other.