mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 08:32:50 -05:00
Use FrozenDictionary
in StaticClientStore
(#3833)
* Add Benchmark * Use FrozenDictionary * Use TryGetValue * Format
This commit is contained in:
@ -80,9 +80,9 @@ public class ClientStore : IClientStore
|
||||
return await CreateUserClientAsync(clientId);
|
||||
}
|
||||
|
||||
if (_staticClientStore.ApiClients.ContainsKey(clientId))
|
||||
if (_staticClientStore.ApiClients.TryGetValue(clientId, out var client))
|
||||
{
|
||||
return _staticClientStore.ApiClients[clientId];
|
||||
return client;
|
||||
}
|
||||
|
||||
return await CreateApiKeyClientAsync(clientId);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Bit.Core.Enums;
|
||||
using System.Collections.Frozen;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Settings;
|
||||
using Duende.IdentityServer.Models;
|
||||
|
||||
@ -16,8 +17,8 @@ public class StaticClientStore
|
||||
new ApiClient(globalSettings, BitwardenClient.Desktop, 30, 1),
|
||||
new ApiClient(globalSettings, BitwardenClient.Cli, 30, 1),
|
||||
new ApiClient(globalSettings, BitwardenClient.DirectoryConnector, 30, 24)
|
||||
}.ToDictionary(c => c.ClientId);
|
||||
}.ToFrozenDictionary(c => c.ClientId);
|
||||
}
|
||||
|
||||
public IDictionary<string, Client> ApiClients { get; private set; }
|
||||
public FrozenDictionary<string, Client> ApiClients { get; }
|
||||
}
|
||||
|
Reference in New Issue
Block a user