I am looking to replace the SQL Session Manager that is provided by Sitecore and I wondered if anyone else had worked on Redis session provider for Sitecore?

  • More specifically what do you need to know? How it's configured? Or if there are any common pitfalls? Otherwise someone might just give you a list of people who have used it. – Anicho Oct 13 '16 at 14:38
  • 1
    A list if fine, I just want some projects to review. – Michael Edwards Oct 13 '16 at 14:56
  • The kicker is the session end event. A polling system like the one Sitecore uses in the Mongo provider isn't ideal in my opinion. There are expiry event callbacks now available on the Azure hosted Redis. This is where I'm looking at the moment. Not sure about Nick Hills project as I haven't seen it yet. – Richard Hauer Oct 13 '16 at 19:46
  • This question is, in my opinion, to broad and to opinion based. There is no real problem described that needs a specific answer. The chat (chat.stackexchange.com/rooms/45324/sitecore) or sitecorechat.slack.com might be used for these kind of questions. – Bas Lijten Oct 13 '16 at 20:36

Nick Hills started a project to enable Redis session state. You can find the details here:

It comes with a warning though: it is not supported by Sitecore!

Context from links above:

Out the box Sitecore offers 3 options for how to handle session when you setup xDB. One option is to keep things in process (inProc). This is ok for testing in dev but isn’t suitable when you have > 1 front end content delivery nodes as each box wouldn’t be able to share the same information. The other two options are: Sql Server or Mongo. See the docs site for more information on how to configure these 2 approaches.

I’ve uploaded an early version of a Sitecore Redis SessionProvider to github: https://github.com/boro2g/Sitecore-Redis-Session-Provider

Conceptually the implementation of Session_End is easy to get your head around – when keys expire you raise up the corresponding events and Sitecore handles the rest. Redis makes this tricky as when keys timeout they don’t raise events and also the data is then gone, so how could it get flushed to xDB?

To work around this I’ve combined the logic in the SitecoreSessionStateStoreProvider which gives you the ability to poll the repository, along with some custom keys to manage the concept of expiration.

By default the asp.net redis implementation creates 3 types of keys:

 DataKey e.g. “{” + applicationName + “_” + id + “}_Data”
 LockKey e.g. “{” + applicationName + “_” + id + “}_Write_Lock”;
 InternalKey e.g. “{” + applicationName + “_” + id + “}_Internal”;
 The new entries will also be:

_log: this is a sorted set that keeps a record of all the marker sets TimeoutKey e.g. “{” + applicationName + “_” + id + “}_Timeout” MarkerKey e.g. yyyy MM dd HH:mm:ss_Marker

Note, this will contain sets of items (i.e. everything that expires at that time) These new keys are used to store when items are added and updated. They are also then referenced in the callback to validate whether specific entries should expire.

In the solution there are the implementation details for the provider along with a console app for monitoring a solution.

enter image description hereconsole app

Do let us know how you get on! It’s worth noting this is currently an alpha release that’s undergone basic testing – any feedback / pull-requests would be greatly appreciated.

FYI If you want to get Redis running locally you can install via chocolatey: https://chocolatey.org/packages/redis-64

| improve this answer | |
  • Worth expanding on the context of the links provided. – Anicho Oct 13 '16 at 14:49
  • I didn't provide much detail because the question was if there was a Redis provider, not how it works. The question is maybe a bit broad and may result in link-only answers. That said, having more detail is not bad so thank you for providing more context in the answer! – Thomas D Oct 14 '16 at 12:48
  • I know :) welcome to revert, if you don't like the detail. I think it helps. – Anicho Oct 14 '16 at 15:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.