开发者

How to automatically remove unused (expired) items from session?

I need functionality that will allow to discard objects from session if they are not used in specified amount of time. It is sim开发者_运维问答milar to Cache timeout functionality.

Is there any session provider (possibly free) or pattern that achives that?


We have created session wrapper that will additionally store information about last usage for each session object. In global.asax Application_PreRequestHandlerExecute we check if the session object has not been used during specified period and if it wasn't we remove it from session.


Why do you need using session? You can use cache instead. For example you can generate cache keys containing user unique identifier, so such entries would be unique for each user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜