Nssession (C module)

From AOLserver Wiki
Jump to: navigation, search

Session module implemented as C module by Bas Scheffers. As a bonus it also comes with a simple cookie API.

Find the latest version at http://bas.scheffers.net/aolserver/.

Tcl API:

  • ns_session exists - check if a session is already created - note that any of the below options implicitely create a session.
  • ns_session [-id id] put key value - put a value in the session, overwrite existing entry with same key.
  • ns_session [-id id] contains key - true (1) if key exists, false (0) otherwise
  • ns_session [-id id] get key [default] - get a value from the session, returns default or empty string if invalid key.
  • ns_session [-id id] delete key - delete a key
  • ns_session [-id id] destroy - invalidate the session
  • ns_session [-id id] keys - list all keys for this session
  • ns_session list - list of all session IDs