I wonder why ns_sls.man is under src/mann and not under src/ where all Tcl API commands are?

Stephen Deasey wrote:
Update of /cvsroot/naviserver/naviserver/doc/src/mann
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28169/doc/src/mann

Added Files:
ns_sls.man Log Message:
        * include/ns.h:
        * nsd/nsd.h
        * nsd/sls.c:
        * nsd/tclcmds.c:
        * nsd/driver.c:
        * nsd/init.c:
        * nsd/Makefile:
        * doc/src/mann/ns_sls.man:
        * tests/ns_sls.test: Add Ns_Sls* and ns_sls commands supporting
        socket-local-storage (data which persists for the lifetime of an
        open TCP connection). Fixes Bug #1522162.


--- NEW FILE: ns_sls.man ---
[include ../version_include]

[manpage_begin ns_sls n [vset version]]
[moddesc   {NaviServer Built-In Commands}]
[titledesc {socket local storage for connections}]

[description]

The underlying TCP socket used by a NaviServer connection may be kept open and
reused for further connections, e.g. during HTTP keep-alive . The [cmd ns_sls]
commands associate data with the socket, which will be available to future
connections on that socket. The data is freed automatically when the socket
closes.

[para]
The data is saved as a string, both for thread safety and to allow easy
sharing with C code using the [cmd Ns_SlsGetKeyed] and [cmd Ns_SlsSetKeyed]
API.

[para]
Per-socket data is often used by socket drivers and protocol
drivers. It may be tempting to save HTTP session data here, but beware:
intermediate HTTP proxies may send multiple, unrelated requests using a single
TCP socket. You may be looking for [cmd Ns_Cls] -- connection local storage.

[para]
All the [cmd ns_sls] commands require an active connection.


[section COMMANDS]
[list_begin definitions]


[call [cmd "ns_sls set"] [arg key] [arg value]]

Set the string value of an sls key. Any old value will be freed. The new value
will be freed automatically when the socket is closed.


[call [cmd "ns_sls get"] [arg key] [opt [arg default]]]

Get the current string value of an sls key. If the key does not exist and no
default was given an error is raised, otherwise the default is returned.


[call [cmd "ns_sls unset"] [arg key]]

Free the data associated with the given key. A key which doesn't exist is
ignored.


[call [cmd "ns_sls array"]]

Return a list of sls keys and values in array-get format.


[list_end]



[section EXAMPLES]

Log the number of connections handled by a single TCP socket:

[example_begin]
    set n [lb][cmd "ns_sls get"] connections 0[rb]
    incr n
    ns_sls set connections $n

    if {$n > 1} {
        ns_log notice connections: $n
    }
[example_end]


Log all the keys and data stored for the socket of the currently active
connection:

[para]
(NB: Does not include C module data set via the [cmd Ns_SlsSet] API)

[example_begin]
    foreach {k v} [lb][cmd "ns_sls array"][rb] {
        ns_log notice sls: $k: $v
    }
[example_end]


[see_also Ns_Sls Ns_Cls]
[keywords sls storage data]
[manpage_end]


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
naviserver-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/naviserver-commits


--
Vlad Seryakov
571 262-8608 office
[EMAIL PROTECTED]
http://www.crystalballinc.com/vlad/


Reply via email to