New caching options for AppFabric Cache when storing ASP.NET session state

What are the โ€œoptimalโ€ options for creating an AppFabric cache when you store session state in the cache? MSDN Cache Related Commands

Powershell Command Prompt:

New-Cache [-CacheName] <String> [-Eviction <String>] [-Expirable <String>] [-Force [<SwitchParameter>]] [-NotificationsEnabled <String>] [-Secondaries <Int32>] [-TimeToLive <Int64>] 
  • CacheName: <application name> -session-state
  • Secondary: 1 (high availability enabled when the server crashes)
  • Eviction:?
  • Expires :?
  • TimeToLive :?
  • Force:?
  • NotificationsEnabled :?

Since I do not want my sessions to be deleted if the session was not deleted using the code or session timeout ...

For eviction, I would have thought โ€œNoโ€ and for the expiration, I think, False.

I tested and called Session.Abandon removes the object from the cache. I also checked if my session is expanding, the session object in the cache is also expanding. This seems to work "correctly."

+6
caching appfabric
source share
1 answer

A post from an MS employee confirms my findings.

2) Because your question is in the context of the session state when you use the session state provider, the session object is cached using a timeout equal to the ASP.Net session timeout. Each time a session is accessed, the session timeout object in the cache also reset to the session timeout. He is convinced that the session object expires from the cache only when the ASP.Net session timed out. Waiting time.

I still need to create a named cache in order to get high availability, but it looks like I can leave the other settings as default.

 New-Cache projectname-session-state -Secondaries 1 
+3
source share

All Articles