cson  Artifact Content

Artifact 1ebca330ab75c1384138a5a699a8abb732d7d1ec:

Wiki page [cson_sessmgr_file] by stephan 2011-05-09 17:58:45.
D 2011-05-09T17:58:45.023
L cson_sessmgr_file
P 8ca49218aa7893f834bad3730ae2552a9da65614
U stephan
W 1367
<strong>ACHTUNG: THIS PAGE IS NOW MAINTAINED IN THE NEW WIKI:</strong> [http://whiki.wanderinghorse.net/wikis/cson/?page=cson_sessmgr_file]


See also: [cson_session], [cson_sessmgr_cpdo], [cson_sessmgr_whio_ht], [cson_sessmgr_whio_epfs]

<h1>File-based [cson_session] Storage</h1>

The factory function <tt>cson_sessmgr_file()</tt> or the name "file" passed to <tt>cson_sessmgr_load()</tt> are used to instantiate a session manager for file-based storage. The second argument to either function is a <tt>cson_object</tt> which should have the following JSON structure:

<verbatim>
{
   "dir": string (directory where to store session files),
   "prefix": string (filename prefix),
   "suffix": string (filename suffix (extension), including leading '.')
}
</verbatim>

If any values are missing, or are not strings, then unspecified defaults are used (which are probably not best-suited to your application). If you don't want prefix/suffix information, set them to empty strings. If they are not set or set to a non-string value (e.g. null or an integer) then those values are ignored and default values are used.

As an example, if we use this configuration:

<verbatim>
{
   "dir": "/tmp",
   "prefix": "cson-session-",
   "suffix": ".json"
}
</verbatim>

Then the session files will be named <tt>/tmp/cson-session-SESSION_ID.json</tt>.

Z 3b3cdc39ebb194879f14b20999291332