(clackup (builder
(<clack-middleware-session>
:state (make-instance '<clack-session-state-cookie>))
(lambda (env)
(sunless (gethash :counter (getf env :clack.session))
(setf it 0))
`(200
(:content-type "text/plain")
(,(format nil "Hello, you've been here for ~Ath times!"
(incf (gethash :counter (getf env :clack.session))))))))) Clack.Middleware.Session provides a session interface. By default this will use cookies to keep session state and store data in memory.
You can change this behavior by inheriting <clack-session-state> and <clack-session-store>.
Note the :clack.session is a hash table, not a plist, because plists cannot keep state between functions.
Eitarow Fukamachi (e.arrows@gmail.com)
Clack Middleware for session management.