In Dynamics 365 Power Apps portals, you can clear the cache of the portal using the PortalCacheService
class. The PortalCacheService
class provides methods to clear the cache for specific entities or for the entire portal.
Here is an example of how you might use C# code to clear the cache for a specific entity in a Dynamics 365 Power Apps portal:
using Microsoft.PowerApps.Portals; // ... public void ClearCacheForEntity(string entityName) { var cacheService = new PortalCacheService(); cacheService.ClearCacheForEntity(entityName); }
And here's how you can clear the entire portal cache:
using Microsoft.PowerApps.Portals; // ... public void ClearAllCache() { var cacheService = new PortalCacheService(); cacheService.ClearAllCache(); }
You can call above methods wherever you want to clear the cache, like in a button click event or on some specific conditions.
Please note that, this code sample is for the portal which is build using Power App portals, if you are using Dynamics 365 portals, the approach will be different. Also, keep in mind that clearing the cache can cause a temporary performance hit on the portal, so it is generally a good idea to clear the cache during off-peak hours or when the portal is not heavily used.
No comments:
Post a Comment