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)
|
||||
{
|
||||
_cache.Set(key, ticket, context =>
|
||||
var options = new MemoryCacheEntryOptions();
|
||||
var expiresUtc = ticket.Properties.ExpiresUtc;
|
||||
if (expiresUtc.HasValue)
|
||||
{
|
||||
var expiresUtc = ticket.Properties.ExpiresUtc;
|
||||
if (expiresUtc.HasValue)
|
||||
{
|
||||
context.SetAbsoluteExpiration(expiresUtc.Value);
|
||||
}
|
||||
context.SetSlidingExpiration(TimeSpan.FromHours(1)); // TODO: configurable.
|
||||
options.SetAbsoluteExpiration(expiresUtc.Value);
|
||||
}
|
||||
options.SetSlidingExpiration(TimeSpan.FromHours(1)); // TODO: configurable.
|
||||
|
||||
_cache.Set(key, ticket, options);
|
||||
|
||||
return (AuthenticationTicket)context.State;
|
||||
});
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue