Installation
To download the planet package:
(require (planet bzlib/session))
The package comes with three separate database installation scripts (one each for sqlite, mysql, and postgresql). You can call them via the following:
;; installing to a sqlite database
(require (planet bzlib/session/setup/jsqlite))
(setup-session-store/jsqlite! <path-to-sqlite-db>)
;; installing to a mysql database
(require (planet bzlib/session/setup/jazmysql))
(setup-session-store/jazmysql! <host> <port> <user>
<password> <schema>)
;; installing to a postgresql database
(require (planet bzlib/session/setup/spgsql))
(setup-session-store/spgsql! <host> <port> <user>
<password> <database>)
Known Issue: the script currently can only be run once and it assumes the table session_t
does not exist in the target database. This will be rectified in the future.Session ID
The session store uses uuid for session IDs.
bzlib/base
provides API for manipulation of uuids.To create an uuid, just run
(make-uuid)
. It can optionally takes in a parameter that are either an uuid in string, and then create the corresponding uuid structure (it can also takes in another uuid structure and make an equivalent uuid structure).
> (require (planet bzlib/base))
> (make-uuid)
#<uuid:4ba52eac-a0b4-415a-88f5-57d1fadd1aba>
> (make-uuid "4ba52eac-a0b4-415a-88f5-57d1fadd1aba")
#<uuid:4ba52eac-a0b4-415a-88f5-57d1fadd1aba>
> (make-uuid (make-uuid "4ba52eac-a0b4-415a-88f5-57d1fadd1aba"))
#<uuid:4ba52eac-a0b4-415a-88f5-57d1fadd1aba>