SSL_CTX_SESS_SET_CACHE_SIZE(3ossl)
π SSL_CTX_SESS_SET_CACHE_SIZE(3ossl) β the OpenSSL glow-up π
okay bestie, so this one's a 3ossl manual page from the OpenSSL fam, and it's literally all about β¨session cache sizeβ¨ β a.k.a. how many sessions your SSL_CTX is allowed to keep cozy inside its internal cache. it's short, it's sweet, and it ate, honestly.
πΈ NAME πΈ
SSL_CTX_sess_set_cache_size, SSL_CTX_sess_get_cache_size β manipulate session cache size π
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, long t);
long SSL_CTX_sess_get_cache_size(SSL_CTX *ctx);
π¦ DESCRIPTION π¦
SSL_CTX_sess_set_cache_size()β sets the size of the internal session cache of contextctxtot. and ngl, this value is a hint, not an absolute β the notes below spill the tea on that one πSSL_CTX_sess_get_cache_size()β returns the currently valid session cache size. that's it, that's the whole function, she's simple and she serves π«Ά
π₯ NOTES π₯
so the default internal session cache size is SSL_SESSION_CACHE_MAX_SIZE_DEFAULT, which is currently 1024*20 β meaning up to 20000 sessions can be held. iconic capacity, honestly π
you can change that size with SSL_CTX_sess_set_cache_size(). and there's a special case bestie, listen: a size of 0 means unlimited size. no cap, zero means infinite here π
if adding a session makes the cache exceed its size, then unused sessions get dropped from the end of the cache. cache space can also be reclaimed by calling SSL_CTX_flush_sessions(3) to remove expired sessions π§Ήβ¨
and if you reduce the size of the session cache while more sessions are already chilling in it, old sessions get removed the next time a session shall be added. heads up though: this removal is not synchronized with the expiration of sessions. so it's giving chaotic timing, not organized β keep that in mind π
π RETURN VALUES π
SSL_CTX_sess_set_cache_size()β returns the previously valid size (yes, the old one, it's cute like that)SSL_CTX_sess_get_cache_size()β returns the currently valid size β
π SEE ALSO π
ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_CTX_sess_number(3), SSL_CTX_flush_sessions(3) β go read these too, they're the supporting cast and they understood the assignment π
π COPYRIGHT π
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>.
fr fr read the license before you do anything, bestie β it's the rules π
and that's the whole page, mwah π this was OpenSSL 3.5.6, dated 2026-04-07, signing off with main character energy πππ¦
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms