Name
http_keep_session, http_recall_session, http_get_cli_sessions, http_client_session_cached — cache and reuse persistent HTTP-client connections
Synopsis
integer http_keep_session(
|
inout session any, |
| in session_key integer, | |
in flags integer); |
any http_recall_session(
|
in session_key integer, |
in flags integer); |
any http_get_cli_sessions(
|
in flags integer); |
integer http_client_session_cached(
|
in session_key integer); |
Description
These BIFs manage Virtuoso's pool of persistent (keep-alive) outbound HTTP client connections. They let an application reuse a single TCP/TLS session across multiple SQL invocations — useful when issuing many small requests to the same backend.
http_keep_session stores
session (a connected socket session as returned by
http_client) in
the cache under the integer session_key.
flags selects the persistence policy (default 0
keeps the session for the duration of the SQL connection; 1 caches it for
the server's lifetime). Returns 1 on success.
http_recall_session retrieves a previously cached
session by key. The returned value is suitable as the
http_client session argument. Returns SQL NULL if no
live session is cached under that key.
http_get_cli_sessions returns a vector of all
currently-cached session keys, optionally filtered by
flags. Useful for inspecting / purging the pool.
http_client_session_cached returns 1 if a live
session is currently cached under session_key, and
0 otherwise (cheaper than http_recall_session when
only existence is needed).