cnblogs / DataProtection.DistributedStore

Use IDistributedCache in Microsoft.Extensions.Caching.Distributed to store keys of Microsoft.AspNetCore.DataProtection.
Apache License 2.0
4 stars 6 forks source link

Provide setting for slidingExpiration time. #1

Open josh-sachs opened 7 years ago

josh-sachs commented 7 years ago

Currently this appears to use the DistributedCache default slidingExpiration time (20 minutes). If this expires in the store, the application breaks. Would be nice to configure this for a much longer expiration without having to change the store default.

e.g. { DataProtectionSlidingExpirationSeconds: 31536000 // 1 year }

cnblogs-dudu commented 7 years ago

I can't reproduce it.

josh-sachs commented 7 years ago

I'm not sure what you mean you can't reproduce it? This isn't a bug - it's a lack of a feature. The library doesn't provide a way to configure the desired TTL for DataProtection cache items... I don't believe it attempts to set the TTL anywhere either. It is just using the default value for DistributedCache (1200 seconds) - which is inappropriate considering if the DataProtetion cache item expires it will break everything issued against those keys.

If you set up SQL DistributedCache provider, or Redis Provider in conjunction with this library it is easy to observe the TTL.