Skip to content

Commit f802402

Browse files
committed
Added an ImapToken cache to try and reduce ImapToken allocations
1 parent 0d66c84 commit f802402

7 files changed

Lines changed: 818 additions & 11 deletions

File tree

MailKit/ByteArrayBuilder.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ public int Length {
4848
get { return length; }
4949
}
5050

51+
public byte this[int index] {
52+
get { return buffer[index]; }
53+
}
54+
55+
public byte[] GetBuffer ()
56+
{
57+
return buffer;
58+
}
59+
5160
[MethodImpl (MethodImplOptions.AggressiveInlining)]
5261
void EnsureCapacity (int capacity)
5362
{

MailKit/MailKit.csproj

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

7474
<ItemGroup>
7575
<Compile Include="Net\Imap\AsyncImapClient.cs" />
76+
<Compile Include="Net\Imap\HashCode.cs" Condition=" $(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0' " />
7677
<Compile Include="Net\Imap\IImapClient.cs" />
7778
<Compile Include="Net\Imap\IImapFolder.cs" />
7879
<Compile Include="Net\Imap\ImapAuthenticationSecretDetector.cs" />
@@ -100,6 +101,7 @@
100101
<Compile Include="Net\Imap\ImapSearchQueryOptimizer.cs" />
101102
<Compile Include="Net\Imap\ImapStream.cs" />
102103
<Compile Include="Net\Imap\ImapToken.cs" />
104+
<Compile Include="Net\Imap\ImapTokenCache.cs" />
103105
<Compile Include="Net\Imap\ImapUtils.cs" />
104106
<Compile Include="Net\Pop3\AsyncPop3Client.cs" />
105107
<Compile Include="Net\Pop3\IPop3Client.cs" />

MailKit/MailKitLite.csproj

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

7575
<ItemGroup>
7676
<Compile Include="Net\Imap\AsyncImapClient.cs" />
77+
<Compile Include="Net\Imap\HashCode.cs" Condition=" $(TargetFramework.StartsWith('net4')) Or '$(TargetFramework)' == 'netstandard2.0' " />
7778
<Compile Include="Net\Imap\IImapClient.cs" />
7879
<Compile Include="Net\Imap\IImapFolder.cs" />
7980
<Compile Include="Net\Imap\ImapAuthenticationSecretDetector.cs" />
@@ -101,6 +102,7 @@
101102
<Compile Include="Net\Imap\ImapSearchQueryOptimizer.cs" />
102103
<Compile Include="Net\Imap\ImapStream.cs" />
103104
<Compile Include="Net\Imap\ImapToken.cs" />
105+
<Compile Include="Net\Imap\ImapTokenCache.cs" />
104106
<Compile Include="Net\Imap\ImapUtils.cs" />
105107
<Compile Include="Net\Pop3\AsyncPop3Client.cs" />
106108
<Compile Include="Net\Pop3\IPop3Client.cs" />

0 commit comments

Comments
 (0)