简体   繁体   English

在ServiceStack中设置会话超时?

[英]set session timeout in ServiceStack?

I'm attempting to use the new ServiceStack session feature. 我正在尝试使用新的ServiceStack会话功能。 I've read through the help page, but I don't see anywhere that you configure the timeout (aka, the expiration date of the objects in the cache). 我已经阅读了帮助页面,但是在配置超时(aka,即缓存中对象的过期日期)的任何地方都看不到。 I expected to be able to set it on the SessionFeature instance created in my AppHost constructor. 我希望能够在我的AppHost构造函数中创建的SessionFeature实例上进行设置。 How is it done? 怎么做? For my application, I need a very short timeout: 30 seconds. 对于我的应用程序,我需要一个非常短的超时时间:30秒。

I figured this out. 我想通了。 It's actually on a per-object basis. 它实际上是基于每个对象的。 You set the timeout when adding to the cache collection through the overloads of Add. 通过Add的重载添加到缓存集合时,可以设置超时。 The default timeout is infinite. 默认超时是无限的。 At least that's what I see on the cache objects. 至少那是我在缓存对象上看到的。 I'm not sure how the cookie part of the equation works. 我不确定等式的Cookie部分如何工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM