how to clear the cache in scoped application using script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-11-2020 01:10 AM
hi Developers I am able to clear the cache via script using ga.cacheFlush(); in global scope but same cannot use in scoped Application
Can anyone suggest any alternative for clearing cache via code in scoped Application
thanks in advance
Regards
harsha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-11-2020 01:45 AM
Hi Harsha,
you need to us gs.cacheFlush() in script include [created in global scope] and call that script include from scoped app. That will clear the cache.
In the script call it like below
var SI = new global.cacheUtil().clearCache();
Script include
name - cacheUtil
Accessible from - All application scopes
var cacheUtil = Class.create(); //(auto generated)
cacheUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
clearCache: function() {
gs.cacheFlush();
}
},
});
Thanks,
Sharjeel
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-11-2020 03:30 AM
In addition to the above response, I would add a couple of recommendations here.
gs.cacheFlush() will clear cache globally for all the users not just for the currently logged in user. So it is recommended not to use in the script that will execute continuously i.e. BR, client scripts [glideAjax], etc. Also, see Chuck Tomasi's response on the below thread to understand when and when not to clear the cache.
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-11-2020 03:42 AM
Sure Muhammad,I will check on that.
regards
Harsha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-11-2020 04:00 AM
Thank you for the update. Let me know if you got any questions.
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-11-2020 04:08 AM
Hi Harsha,
Check below links, it will help you
If my answer helped you in any way, mark answer as helpful and correct.
Thanks and regards,
Megha