Reacting to Caching api review changes
This commit is contained in:
parent
af2c524352
commit
76bd1a2f17
|
|
@ -26,17 +26,16 @@ namespace CookieSessionSample
|
||||||
|
|
||||||
public Task RenewAsync(string key, AuthenticationTicket ticket)
|
public Task RenewAsync(string key, AuthenticationTicket ticket)
|
||||||
{
|
{
|
||||||
_cache.Set(key, ticket, context =>
|
var options = new MemoryCacheEntryOptions();
|
||||||
|
var expiresUtc = ticket.Properties.ExpiresUtc;
|
||||||
|
if (expiresUtc.HasValue)
|
||||||
{
|
{
|
||||||
var expiresUtc = ticket.Properties.ExpiresUtc;
|
options.SetAbsoluteExpiration(expiresUtc.Value);
|
||||||
if (expiresUtc.HasValue)
|
}
|
||||||
{
|
options.SetSlidingExpiration(TimeSpan.FromHours(1)); // TODO: configurable.
|
||||||
context.SetAbsoluteExpiration(expiresUtc.Value);
|
|
||||||
}
|
_cache.Set(key, ticket, options);
|
||||||
context.SetSlidingExpiration(TimeSpan.FromHours(1)); // TODO: configurable.
|
|
||||||
|
|
||||||
return (AuthenticationTicket)context.State;
|
|
||||||
});
|
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue