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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Clear cache with code (X++)

(0) ShareShare
ReportReport
Posted on by 6,648

Hi ALL,

How we can clear cache such as (record cache, global object cache, browser cache, various caches in SQL Server and many more,...) with Code?

Could you please give me sample code?

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,783 Most Valuable Professional on at

    Hi Hossein, only some caches are reachable from X++. For instance, you can remove entries from the global cache of your session, but you can't clear browser cache on the client machine.

    By the way, I fixed your spelling of cache (from "cash"); using the right spelling will help you when searching for existing information on internet.

  • Hossein.K Profile Picture
    6,648 on at

    Hi Martin,

    you can give a sample code for clear cashe which is access in x ++?

    I want to clear cashes which is access manualy(AOT/Tools/Cashes/...)

    Thanks.

  • Suggested answer
    Martin Dráb Profile Picture
    237,783 Most Valuable Professional on at

    A few examples:

    • SysFlush* classes
    • SysGlobalObjectCache::clearAllCaches()

    By the way, it's really "cache", not "cash".

  • Verified answer
    Galyna Fedorova Profile Picture
    3,566 on at

    Try to check this link gfeaxblog.wordpress.com/.../ax-2012-clear-the-cache

  • Hossein.K Profile Picture
    6,648 on at

    Hi Galyna,

    When I run your code(job),I face with this error:

    0312.Untitled.png

  • Martin Dráb Profile Picture
    237,783 Most Valuable Professional on at

    Please show the full error message, including the stack trace.

  • Galyna Fedorova Profile Picture
    3,566 on at

    Please change the quotes in the info. Instead of “, please use "

  • Jie G Profile Picture
    on at

    Hi Hossein,

    The job in https://gfeaxblog.wordpress.com/2017/12/14/ax-2012-clear-the-cache/ works fine in my test machine. Did you build it successfully? 

  • Hossein.K Profile Picture
    6,648 on at

    Hi Galyna

    your answer is correct.

    Thanks

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

#2
Rahul.p Profile Picture

Rahul.p 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans