Add CancellationToken to ISession Load/CommitAsync

This commit is contained in:
Chris R 2017-06-28 14:52:14 -07:00
parent 596822f676
commit 85402d4bd6
3 changed files with 26 additions and 4 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Http
@ -28,13 +29,13 @@ namespace Microsoft.AspNetCore.Http
/// Load the session from the data store. This may throw if the data store is unavailable.
/// </summary>
/// <returns></returns>
Task LoadAsync();
Task LoadAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Store the session in the data store. This may throw if the data store is unavailable.
/// </summary>
/// <returns></returns>
Task CommitAsync();
Task CommitAsync(CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Retrieve the value of the given key, if present.

View File

@ -8,5 +8,25 @@
"TypeId": "public interface Microsoft.AspNetCore.Http.IHeaderDictionary : System.Collections.Generic.IDictionary<System.String, Microsoft.Extensions.Primitives.StringValues>",
"MemberId": "System.Void set_ContentLength(System.Nullable<System.Int64> value)",
"Kind": "Addition"
},
{
"TypeId": "public interface Microsoft.AspNetCore.Http.ISession",
"MemberId": "System.Threading.Tasks.Task CommitAsync()",
"Kind": "Removal"
},
{
"TypeId": "public interface Microsoft.AspNetCore.Http.ISession",
"MemberId": "System.Threading.Tasks.Task LoadAsync()",
"Kind": "Removal"
},
{
"TypeId": "public interface Microsoft.AspNetCore.Http.ISession",
"MemberId": "System.Threading.Tasks.Task CommitAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))",
"Kind": "Addition"
},
{
"TypeId": "public interface Microsoft.AspNetCore.Http.ISession",
"MemberId": "System.Threading.Tasks.Task LoadAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))",
"Kind": "Addition"
}
]

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Net.WebSockets;
using System.Reflection;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
using Xunit;
@ -301,12 +302,12 @@ namespace Microsoft.AspNetCore.Http
_store.Clear();
}
public Task CommitAsync()
public Task CommitAsync(CancellationToken cancellationToken)
{
return Task.FromResult(0);
}
public Task LoadAsync()
public Task LoadAsync(CancellationToken cancellationToken)
{
return Task.FromResult(0);
}