web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to get total items/elements stored in SysGlobalObjectCache

(0) ShareShare
ReportReport
Posted on by

The SysGlobalObjectCache class does not seem to have any method that returns the current number of items stored in it. Is there any other way to determine how many items are stored in the global object cache? Is it possible to get this on a per scope basis as well?

*This post is locked for comments

I have the same question (0)
  • gyan chand kabra Profile Picture
    380 on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Hi Mike,

    There are some methods to insert and find the values stored in the SysGlobalObjectCache class.

    For more detail go through the below link.

    msdn.microsoft.com/.../hh608239.aspx

  • Community Member Profile Picture
    on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Hi Gyan, yes I am able to insert and find items in the System Global Object Cache. I'm interested in determining how many items are currently stored in the System Global Object Cache and if it is possible to get the total count per scope.

  • Suggested answer
    dolee Profile Picture
    11,279 on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Hi Mike,

    I don't think there is standard function for that.

    You probably need to write your own class/functions extending SysGlobalObjectCache to have such visibility. And you will only have information on variables/items added using the extended class/functions.

  • Verified answer
    PA-22040759-0 Profile Picture
    6,194 on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Hi Mike,

    I can't see that there is any way to check that. You could maybe write a wrapper if you want to track certain objects and then do your only count, but even if you do that I think the kernel cache can remove objects without your wrapper getting notified.

    Maybe the community can come up with some new ideas if you can describe your requirement, i.e. why you want to know the number of objects in the cache.

  • Denis Macchinetti Profile Picture
    16,444 on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Hi Guys

    Interesting question!

    I also would like to know how many elements are stored in the SysGlobalObjectCache.

    As you know, there is a parameter on Server Configuration form, where you can set the Global Object Cache elements. The default is 100000

    So, according your business could be interesting to know how many elements are stored in the SysGlobalObjectCache for modify, if necessary, the Cache parameter.

    But, the class don't have any method that return the elements number.

    Honestly, I don't know if AX raise a error if the max elements are reached.

    A week ago, on a Customer, the MRP process stay in execution and don't finish anymore.

    After a intense debug, I faced a infinite loop during searching items on the

    SysGlobalObjectCache class.

    I have increased the Cache parameter and after that the problem disappear.

    I hope this help you.

  • Community Member Profile Picture
    on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Thank you for the replies so far. I am surprised MS did not have any method for determining the number of items stored in the system global object cache. Creating a wrapper for the SysGlobalObjectCache seems to be the way to go based on Palle's post.

    I'm not sure if items in the SGOC are removed by the kernel itself. Since I'm new to AX, I think X++ code need to explicitly clear or remove them and they are only getting replaced by newer items if the cache reaches its configured maximum number of records based on LRU (Lease Recently Used).

  • Frankie Zhao Profile Picture
    75 on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Once cache is full, AX will face to terrible performance issue, as the new cache will replace the most "useless" record within the cache, which operation is very time consuming. We should try our best to avoid hitting the limit. Back to this question, i also have an interest to know how many records the cache is holding. Maybe someone can give some fresh ideas on this.

  • Nicolas GRANJON Profile Picture
    510 on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Hi,

    There is a print() method on the sgoc object that takes a scope as a parameter and print, in the infolog, all the elements that are stored in the cache for that scope.

    Then you could possibly get the number of printed lines in the infolog to get the number of current elements for your scope.

    Sounds a little tricky but it should work...

  • Douglas Noel Profile Picture
    3,905 on at
    RE: How to get total items/elements stored in SysGlobalObjectCache

    Hi all,

    did already one have entered this in MS Connect?

    regards

    Douglas

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans