Open KaishM opened 5 years ago
@KaishM Thanks for the feedback! We are currently investigating and will update you shortly.
@KaishM Thanks for reporting this. The sample code provided is just an example of implementation and needs to be customized based on your environment. You can implement cache clean up in the following ways. 1) Clean up the cache on a timer. 2) Schedule an asynchronous task to remove the cache entry on expiry. 3) Check the cache size when TryAdd is called and trigger an asynchronous cleanup job.
I agree that this should be included in the sample provided for better customer experience and I am assigning this to the author to consider adding this to the sample code provided in the doc.
Below code does not set expiration of cached token which means at certain point, there will not be any space left for new token to be cached ?
public bool TryAdd(string securityToken, DateTime expiresOn) { if (this.cache.Get<string>(securityToken) == null) { this.cache.Set(securityToken, securityToken); return true; } return false; }
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.