1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

Use FrozenDictionary in StaticClientStore (#3833)

* Add Benchmark

* Use FrozenDictionary

* Use TryGetValue

* Format
This commit is contained in:
Justin Baur
2024-02-21 10:29:59 -05:00
committed by GitHub
parent 0abd52b5be
commit 70fac808b0
3 changed files with 33 additions and 5 deletions

View File

@ -0,0 +1,27 @@
using BenchmarkDotNet.Attributes;
using Bit.Core.Settings;
using Bit.Identity.IdentityServer;
using Duende.IdentityServer.Models;
namespace Bit.MicroBenchmarks.Identity.IdentityServer;
public class StaticClientStoreTests
{
private readonly StaticClientStore _store;
public StaticClientStoreTests()
{
_store = new StaticClientStore(new GlobalSettings());
}
[Params("mobile", "connector", "invalid", "a_much_longer_invalid_value_that_i_am_making_up", "WEB", "")]
public string? ClientId { get; set; }
[Benchmark]
public Client? TryGetValue()
{
return _store.ApiClients.TryGetValue(ClientId, out var client)
? client
: null;
}
}