19 Sessions ¶
You can use #:session mode
to define a URL rule handler.
(post "/auth" #:session mode
(lambda (rc) ...))
mode can be:
- #t or ’spawn, to spawn a new session, the name of the SID is "sid" by default.
- ‘(spawn ,sid) to specify the name of the sid to spawn.
- ‘(spawn ,sid ,proc) to specify the name of the sid and a proc to define your own session spawner.
And the APIs of the session is :session
(:session rc cmd)
cmd can be:
- ’check to check the session with name "sid".
- ‘(check ,sid) to check the session with a specified sid name.
- ’check-and-spawn to check "sid" first, if it doesn’t exist, then spawn new.
- ‘(check-and-spawn ,sid) to do the same as above, but with specifying the sid name.
- ‘(check-and-spawn-and-keep ,sid) to check, then spawn, then keep, specifying the sid name.
- ’spawn to spawn a session with the name "sid".
- ’spawn-and-keep to spawn a session then keep with the name "sid".
- ’drop to remove the current session by "sid".
- ‘(drop ,sid) to remove the session by the specifed sid.