SSL_CTX_FLUSH_SESSIONS(3)
π SSL_CTX_FLUSH_SESSIONS(3) π
okay so this is a page from the Library Functions Manual (the libssl / libcrypto girlies, you know the ones) and it's literally about cleaning out expired sessions. it's giving spring cleaning but for your TLS cache. π§Ήβ¨
πΈ NAME πΈ
SSL_CTX_flush_sessions β remove expired sessions, bestie. that's it, that's the whole vibe. ποΈ
β¨ SYNOPSIS β¨
kay so first you gotta pull in the header, the library is libssl libcrypto and the include is this:
#include <openssl/ssl.h>
and then the function itself, no cap:
void
SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm);
π¦ DESCRIPTION π¦
so SSL_CTX_flush_sessions() does a whole little walk-through of the session cache of ctx and removes every session that's expired at time tm. like a bouncer checking IDs but for expirations. πβ¨
if it's enabled, the internal session cache will collect all the sessions established up to the specified maximum number (peep SSL_CTX_sess_set_cache_size(3) for that one). and here's the thing β once sessions are expired they are not getting reused, so lowkey they should just be removed from the cache to save resources. iconic resource management. π
and you've got two ways to do it:
- automatically, whenever 255 new sessions were established (see
SSL_CTX_set_session_cache_mode(3)) - or manually, by calling
SSL_CTX_flush_sessions()yourself
the parameter tm specifies the time that should be used for the expiration test β and in most cases the actual time given by time(0) will be used. fr fr, that's the usual move. β°
heads up:SSL_CTX_flush_sessions()will only check sessions stored in the internal cache. when a session is found and removed, though, theremove_session_cbdoes get called to synchronize with the external cache (seeSSL_CTX_sess_set_get_cb(3)). so the external cache still gets its little notification, periodt. π«Ά
π SEE ALSO π
go read these next, iykwim:
π HISTORY π
SSL_CTX_flush_sessions() first appeared in SSLeay 0.8.0 and has been available since OpenBSD 2.4. she's been around a minute, and honestly? she ate. π
β
and that's the whole page bestie π«Ά this drop was brought to you by Debian, dated June 8, 2025, filed under SSL_CTX_FLUSH_SESSIONS(3) β go flush those sessions, mwah ππ§β¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2001 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms