Skip to content

Commit ee1b988

Browse files
committed
Added an ImapToken cache to try and reduce ImapToken allocations
1 parent 5f0cca3 commit ee1b988

6 files changed

Lines changed: 734 additions & 1 deletion

File tree

MailKit/ByteArrayBuilder.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ public int Length {
4545
get { return length; }
4646
}
4747

48+
public byte this[int index] {
49+
get { return buffer[index]; }
50+
}
51+
52+
public byte[] GetBuffer ()
53+
{
54+
return buffer;
55+
}
56+
4857
void EnsureCapacity (int capacity)
4958
{
5059
if (capacity > buffer.Length) {

MailKit/MailKit.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464

6565
<ItemGroup>
6666
<Compile Include="Net\Imap\AsyncImapClient.cs" />
67+
<Compile Include="Net\Imap\HashCode.cs" Condition=" $(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0' " />
6768
<Compile Include="Net\Imap\IImapClient.cs" />
6869
<Compile Include="Net\Imap\IImapFolder.cs" />
6970
<Compile Include="Net\Imap\ImapAuthenticationSecretDetector.cs" />
@@ -88,6 +89,7 @@
8889
<Compile Include="Net\Imap\ImapSearchQueryOptimizer.cs" />
8990
<Compile Include="Net\Imap\ImapStream.cs" />
9091
<Compile Include="Net\Imap\ImapToken.cs" />
92+
<Compile Include="Net\Imap\ImapTokenCache.cs" />
9193
<Compile Include="Net\Imap\ImapUtils.cs" />
9294
<Compile Include="Net\Pop3\AsyncPop3Client.cs" />
9395
<Compile Include="Net\Pop3\IPop3Client.cs" />

MailKit/MailKitLite.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969

7070
<ItemGroup>
7171
<Compile Include="Net\Imap\AsyncImapClient.cs" />
72+
<Compile Include="Net\Imap\HashCode.cs" Condition=" $(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0' " />
7273
<Compile Include="Net\Imap\IImapClient.cs" />
7374
<Compile Include="Net\Imap\IImapFolder.cs" />
7475
<Compile Include="Net\Imap\ImapAuthenticationSecretDetector.cs" />
@@ -93,6 +94,7 @@
9394
<Compile Include="Net\Imap\ImapSearchQueryOptimizer.cs" />
9495
<Compile Include="Net\Imap\ImapStream.cs" />
9596
<Compile Include="Net\Imap\ImapToken.cs" />
97+
<Compile Include="Net\Imap\ImapTokenCache.cs" />
9698
<Compile Include="Net\Imap\ImapUtils.cs" />
9799
<Compile Include="Net\Pop3\AsyncPop3Client.cs" />
98100
<Compile Include="Net\Pop3\IPop3Client.cs" />

0 commit comments

Comments
 (0)