AzureAD/microsoft-authentication-library-for-go

[Documentation] How to use the built-in cache?

Logankwb opened this issue · 0 comments

Documentation related to component

Cache

Please check all that apply

  • typo
  • documentation doesn't exist
  • documentation needs clarification
  • error(s) in the example
  • needs an example

Description of the issue

The README says Utilizing the cache is optional, but we would highly recommend it. As a user of this library, I read this as there's a default cache that one would opt-in to with the WithCache() option - perhaps with cache.Default being the default implementation.

With there not being any obvious default implementation to refer to when adding the WithCache() option, I then assume that the default cache is enabled by default. But then how would one opt out?

Following the code a little, it looks like if no cache is specified, then the noopCacheAccessor{} is used, which doesn't appear to cache anything

https://github.com/AzureAD/microsoft-authentication-library-for-go/blob/dev/apps/internal/base/base.go#L219

Is there an actual implementation that gets used with WithCache isn't specified? And if we do need to with WithCache, how do we use the built-in implementation?