Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature Request] Expose the MemoryCacheOptions for the L1 cache in the MsalDistributedTokenCacheAdapterOptions #1048

Closed
jmprieur opened this issue Mar 5, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request fixed
Milestone

Comments

@jmprieur
Copy link
Collaborator

jmprieur commented Mar 5, 2021

Is your feature request related to a problem? Please describe.
Today, MsalDistributedTokenCacheAdapterOptions exposes L1CacheSizeLimit and L1ExpirationTimeRatio.

Describe the solution you'd like

  • @henrik-me proposed that we expose all the settings of the L1 cache
  • Make sure that the contructor of MsalDistributedTokenCacheAdapterOptions also news up a MemoryCacheOptions, and sets the SizeLimit to 500 Mb.
public class MsalDistributedTokenCacheAdapterOptions : DistributedCacheEntryOptions
{
 /// <summary>
 /// Options of the L1 cache.
 /// </summary>
 public MemoryCacheOptions L1CacheOptions { get; set; } = new MemoryCacheOptions()
 {
   SizeLimit = 500 * 1024 * 1024,   // 500 Mb
 };

 /// <summary>
 /// Callback offered to the app to be notified when the L2 cache fails.
 /// This way the app is given the possibility to act on the L2 cache,
 /// for instance, in the case of Redis, to reconnect. This is left to the application as it's
 /// the only one that knows about the real implementation of the L2 cache.
 /// The handler should return <c>true</c> if the cache should try again the operation, and
 /// <c>false</c> otherwise. When <c>true</c> is passed and the retry fails, an exception
 /// will be thrown.
 /// </summary>
 public Func<Exception, bool>? OnL2CacheFailure { get; set; }
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request fixed
Projects
None yet
Development

No branches or pull requests

2 participants