This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
InMemory Provider
Daniel J. Summers edited this page Aug 7, 2016
·
1 revision
This session store simply stores the session in process memory.
Provide an instance of InMemorySessionConfiguration
for the [config]
parameter in the
examples on Nancy.Session.Persistable. (You
will need to open/use the Nancy.Session.InMemory namespace as well, or specify the fully-qualified name.)
This provider requires no specific configuration options; however, the ones on Nancy.Session.Persistable still apply.
Why is there a "persistable" session store that doesn't actually persist sessions? Good question.
- If all you want is a place to keep sessions (a Q&D SDHP, if you will), and you don't care that they survive restarts, but you like the strongly-typed session member features - use this.
- If you're developing an application and you know you'll want persistent sessions, but you don't want to actually
figure out what persistence implementation you will use - use this as a working stand-in until you get back to that
// TODO
comment.
The development and implementation of this also serves a few purposes:
- When abstracting the RethinkDB session store into what is now the Nancy.Session.Persistable project, I wanted a second implementation to prove that the interface was sufficient.
- The store itself uses a static mutable instance of an F# immutable list; as each list is immutable, each session is stored as an immutable object, and the framework synchronizes access to static members, race conditions should not be a problem.
- I wanted to address the two use cases above.