Blog Post
Re: Token Cache Service Inside D365 CE Plugin Base
3 Comments
- PravinT
Microsoft
Good point! CE plugins are designed for a sandboxed, serverless SaaS model, so the focus isn’t on underlying hosting but on reducing token calls from thousands to a handful. It’s an optional optimization for cases where that few seconds of token fetch time matters.
- angelonicCopper Contributor
Yes, absolutely! However, the cache can be used more generically and to save queries to the dataverse. It's a shame that it's not possible to create a “real-time” invalidation system for all hosts.
Anyway, thanks a lot for the tip!
- PravinT
Microsoft
You make an excellent point—those robust caching strategies are certainly more applicable when building custom line-of-business (LOB) applications rather than SaaS solutions like Dynamics 365.
Please note, this example is NOT intended to encourage caching Dataverse data inside plugins; we kindly ask that this approach be avoided. Our guidance remains to always access Dataverse data through IOrganizationService inside of Plugins.
Please understand, the tip here is simply about reducing costly, presumably external calls where possible—not about expanding this idea aggressively across scenarios. It’s meant for very specific cases where external dependencies can be optimized, not as a general pattern.