By default, Luminus generates our app to use an in-memory session store with adequate defaults. The session default settings are specified in the hipstr.handler/session-defaults
:
;; timeout sessions after 30 minutes (def session-defaults {:timeout (* 60 30) :timeout-response (redirect "/")})
The preceding code sets default session-timeout to 30 minutes, at which point the user will be redirected to root (/
).
In addition to the :timeout
and :timeout-response
options, we can also define the following:
:cookie-name
[string]: This is the name for the session cookie (which defaults to ring-session):cookie-attrs
[map]: This is a map of standard cookie options to be applied to the session cookie. See Setting the cookie as a map section later in this chapter for more details:store
: This allows us to define an alternate store to the default in-memory session store. Setting up an alternative to the in-memory session store is beyond the scope of this book.