Want to clear particular cache by using cache key in business rule
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 07:13 AM - edited 07-16-2025 07:15 AM
Basically, I am trying to override function: getMySubscriptions from script include: ServiceSubscriptionUtilsSNC, because I want to add few more conditions on
_addGroup function.
var SUBSCRIPTIONS_CACHE = 'SUBSCRIPTIONS_CACHE';
// check the SUBSCRIPTIONS_CACHE if the there is an offering sys_ids array already associated to the user
var userCachedSubscriptionsArr = sn_scoped_cache.ScopedCacheManager.get(SUBSCRIPTIONS_CACHE, userId);
if (userCachedSubscriptionsArr)
return JSON.parse(userCachedSubscriptionsArr);
I want to clear this SUBSCRIPTIONS_CACHE cache for particular user from business rule.
Tried the following, but didnt help.
Option_1:
var sm = GlideSecurityManager.get();
sm.setUser(gs.getUser());
Option_2:
sn_scoped_cache.ScopedCacheManager.flushScopedCache("SUBSCRIPTIONS_CACHE");
Option_3:
var user = gs.getUserID();
sn_scoped_cache.ScopedCacheManager.flushScopedCache("SUBSCRIPTIONS_CACHE", user);
the only thing working as expected is, full flush:
gs.cacheFlush();
But full flesh is not recommended. Please suggest any other approach. Thanks in advance.
0 REPLIES 0