1=pod
2
3=head1 NAME
4
5SSL_CTX_flush_sessions_ex, SSL_CTX_flush_sessions - remove expired sessions
6
7=head1 SYNOPSIS
8
9 #include <openssl/ssl.h>
10
11 void SSL_CTX_flush_sessions_ex(SSL_CTX *ctx, time_t tm);
12
13The following functions have been deprecated since OpenSSL 3.4, and can be
14hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
15see L<openssl_user_macros(7)>:
16
17 void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm);
18
19=head1 DESCRIPTION
20
21SSL_CTX_flush_sessions_ex() causes a run through the session cache of
22B<ctx> to remove sessions expired at time B<tm>.
23
24SSL_CTX_flush_sessions() is an older variant of the function that is not
25Y2038 safe due to usage of long datatype instead of time_t.
26
27=head1 NOTES
28
29If enabled, the internal session cache will collect all sessions established
30up to the specified maximum number (see SSL_CTX_sess_set_cache_size()).
31As sessions will not be reused ones they are expired, they should be
32removed from the cache to save resources. This can either be done
33automatically whenever 255 new sessions were established (see
34L<SSL_CTX_set_session_cache_mode(3)>)
35or manually by calling SSL_CTX_flush_sessions_ex().
36
37The parameter B<tm> specifies the time which should be used for the
38expiration test, in most cases the actual time given by time(0)
39will be used.
40
41SSL_CTX_flush_sessions_ex() will only check sessions stored in the internal
42cache. When a session is found and removed, the remove_session_cb is however
43called to synchronize with the external cache (see
44L<SSL_CTX_sess_set_get_cb(3)>).
45
46=head1 RETURN VALUES
47
48SSL_CTX_flush_sessions_ex() does not return a value.
49
50=head1 SEE ALSO
51
52L<ssl(7)>,
53L<SSL_CTX_set_session_cache_mode(3)>,
54L<SSL_CTX_set_timeout(3)>,
55L<SSL_CTX_sess_set_get_cb(3)>
56
57=head1 HISTORY
58
59SSL_CTX_flush_sessions_ex() was added in OpenSSL 3.4.
60
61=head1 COPYRIGHT
62
63Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.
64
65Licensed under the Apache License 2.0 (the "License").  You may not use
66this file except in compliance with the License.  You can obtain a copy
67in the file LICENSE in the source distribution or at
68L<https://www.openssl.org/source/license.html>.
69
70=cut
71