SSL_CTX_SESS_NUMBER(3ossl)

πŸ’– SSL_CTX_SESS_NUMBER πŸ’–

okay bestie, so this is a page from the OpenSSL manual β€” third section (3ossl), the library-calls girlies. and no cap, this one is just reading the vibes of your session cache πŸŽ€

It's the home of SSL_CTX_sess_number, SSL_CTX_sess_connect, SSL_CTX_sess_connect_good, SSL_CTX_sess_connect_renegotiate, SSL_CTX_sess_accept, SSL_CTX_sess_accept_good, SSL_CTX_sess_accept_renegotiate, SSL_CTX_sess_hits, SSL_CTX_sess_cb_hits, SSL_CTX_sess_misses, SSL_CTX_sess_timeouts, and SSL_CTX_sess_cache_full β€” a whole little friend group whose entire job is obtaining session cache statistics ✨


✨ SYNOPSIS ✨

#include <openssl/ssl.h>

long SSL_CTX_sess_number(SSL_CTX *ctx);
long SSL_CTX_sess_connect(SSL_CTX *ctx);
long SSL_CTX_sess_connect_good(SSL_CTX *ctx);
long SSL_CTX_sess_connect_renegotiate(SSL_CTX *ctx);
long SSL_CTX_sess_accept(SSL_CTX *ctx);
long SSL_CTX_sess_accept_good(SSL_CTX *ctx);
long SSL_CTX_sess_accept_renegotiate(SSL_CTX *ctx);
long SSL_CTX_sess_hits(SSL_CTX *ctx);
long SSL_CTX_sess_cb_hits(SSL_CTX *ctx);
long SSL_CTX_sess_misses(SSL_CTX *ctx);
long SSL_CTX_sess_timeouts(SSL_CTX *ctx);
long SSL_CTX_sess_cache_full(SSL_CTX *ctx);

like, every single one of them takes your SSL_CTX *ctx and hands you back a long. that's it. no drama πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea on each one, one by one, no skipping πŸ“

  • SSL_CTX_sess_number() β€” returns the current number of sessions chillin' in the internal session cache.
  • SSL_CTX_sess_connect() β€” returns the number of SSL/TLS handshakes that got started in client mode.
  • SSL_CTX_sess_connect_good() β€” returns the number of SSL/TLS sessions that were successfully established in client mode. the success stories πŸ’š
  • SSL_CTX_sess_connect_renegotiate() β€” returns the number of renegotiations that got started in client mode.
  • SSL_CTX_sess_accept() β€” returns the number of SSL/TLS handshakes that got started in server mode.
  • SSL_CTX_sess_accept_good() β€” returns the number of SSL/TLS sessions successfully established in server mode.
  • SSL_CTX_sess_accept_renegotiate() β€” returns the number of renegotiations that got started in server mode.
  • SSL_CTX_sess_hits() β€” returns the number of successfully reused sessions. two flavours, bestie:
    • in client mode, a session that was set with SSL_set_session(3) and then successfully reused counts as a hit 🎯
    • in server mode, a session successfully retrieved from the internal or external cache counts as a hit 🎯
  • SSL_CTX_sess_cb_hits() β€” returns the number of successfully retrieved sessions from the external session cache in server mode.
  • SSL_CTX_sess_misses() β€” returns the number of sessions proposed by clients that were not found in the internal session cache in server mode. the flops 😭
  • SSL_CTX_sess_timeouts() β€” returns the number of sessions proposed by clients, and either found in the internal or external session cache in server mode, that were invalid due to timeout. and listen β€” these sessions are not included in the SSL_CTX_sess_hits() count. don't double-count, that's not the vibe πŸ™ˆ
  • SSL_CTX_sess_cache_full() β€” returns the number of sessions that got removed because the maximum session cache size was exceeded. evicted, literally.

🌸 RETURN VALUES 🌸

the functions return the values indicated in the DESCRIPTION section. yeah. that's the whole section. they just return what we already said. iconic honestly πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘


Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


and that's the whole page, bestie!! go forth and count your sessions 🫢✨

OpenSSL 3.5.9 Β· 2026-09-29 Β· mwah, love u, bye πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from