Redis backed ASP.NET SessionState provider [closed] Redis backed ASP.NET SessionState provider [closed] asp.net asp.net

Redis backed ASP.NET SessionState provider [closed]


I've created a Redis-based SessionStateStoreProvider that can be found on GitHub using ServiceStatck.Redis as the client (rather than Booksleeve).

It can be installed via NuGet with Install-Package Harbour.RedisSessionStateStore.

I found a few quirks with @NathanD's approach. In my implementation, locks are stored with the session value rather than in a separate key (less round trips to Redis). Additionally, because it uses ServiceStack.Redis, it can used pooled connections.

Finally, it's tested. This was my biggest turn off from @NathanD's approach. There was no way of actually knowing if it worked without running through every use case manually.


Not only would it be useful, but I strongly consider you look closely at the Redis' Hash datatype if you plan to go down this road. In our application the session is basically a small collection of keys and values (i.e.: {user_id: 7, default_timezone: 'America/Chicago', ...}) with the entire user session stored under in a single Redis hash.

Not only does using Hash simplify mapping the data if your session data is similar, but Redis uses space much more efficiently with this approach.

Our app is in ruby, but you might still find some use from what we wrote.