-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add _lastKnownGoodConfigurationCache into ctor
- Loading branch information
Showing
8 changed files
with
105 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...Microsoft.IdentityModel.Protocols/Configuration/LastKnownGoodConfigurationCacheOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
using Microsoft.IdentityModel.Tokens; | ||
using Microsoft.IdentityModel.Logging; | ||
|
||
namespace Microsoft.IdentityModel.Protocols.Configuration | ||
{ | ||
/// <summary> | ||
/// Specifies the LastKnownGoodConfigurationCacheOptions which can be used to configure the internal LKG configuration cache. | ||
/// See <see cref="EventBasedLRUCache{TKey, TValue}"/> for more details. | ||
/// </summary> | ||
public class LastKnownGoodConfigurationCacheOptions | ||
{ | ||
private IEqualityComparer<BaseConfiguration> _baseConfigurationComparer = new BaseConfigurationComparer(); | ||
private int _lastKnownGoodConfigurationSizeLimit = DefaultLastKnownGoodConfigurationSizeLimit; | ||
|
||
/// <summary> | ||
/// 10 is the default size limit of the cache (in number of items) for last known good configuration. | ||
/// </summary> | ||
public static readonly int DefaultLastKnownGoodConfigurationSizeLimit = 10; | ||
|
||
/// <summary> | ||
/// Gets or sets the BaseConfgiurationComparer that to compare <see cref="BaseConfiguration"/>. | ||
/// </summary> | ||
public IEqualityComparer<BaseConfiguration> BaseConfigurationComparer | ||
{ | ||
get { return _baseConfigurationComparer; } | ||
set | ||
{ | ||
_baseConfigurationComparer = value ?? throw LogHelper.LogExceptionMessage(new ArgumentNullException(nameof(value))); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// The size limit of the cache (in number of items) for last known good configuration. | ||
/// </summary> | ||
public int LastKnownGoodConfigurationSizeLimit | ||
{ | ||
get { return _lastKnownGoodConfigurationSizeLimit; } | ||
set | ||
{ | ||
_lastKnownGoodConfigurationSizeLimit = (value > 0) ? value : throw LogHelper.LogExceptionMessage(new ArgumentOutOfRangeException(nameof(value))); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters