-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Looking for implementation-specific configuration? Here you go!
Opening/using/importing the Nancy.Session.Persistable
namespace adds an extension PersistableSession
property (F#) or method (C# / VB.NET) on the Nancy Request
object. This returns an IPersistableSession
, which extends Nancy's ISession
interface with a few additional methods.
-
Get<T>() can be used to retrieve a strongly-typed item from the session. If the item does not exist, this method will return
null
(or a default value for value types). -
GetOrDefault<T>() works the same way as
Get<T>()
, but you specify the value you want back if there's not a value in the session.
Each implementation comes with its own configuration object, but they all share some common options.
UseRollingSessions (bool - default: true)
A rolling session is one where the expiration is reset every time the session is accessed, making the expiration into a rolling window. A non-rolling session is only good from the time of its creation, and goes away at the end of that period, no matter how active the session is.
Expiry (TimeSpan - default: 2 hours)
This is how long (based on either creation or access time) the session will last.
ExpiryCheckFrequency (TimeSpan - default: 1 minute)
This is how frequently expired sessions are removed from the store. Each attempt to load or save a session can trigger this, but this throttle keeps it from running on every request.