.TH ssl_session_cache_api 3erl "ssl 10.9.1.3" "Ericsson AB" "Erlang Module Definition" .SH NAME ssl_session_cache_api \- TLS session cache API .SH DESCRIPTION .LP Defines the API for the TLS session cache (pre TLS-1\&.3) so that the data storage scheme can be replaced by defining a new callback module implementing this API\&. .SH DATA TYPES .nf \fBsession_cache_ref()\fR\& = any() .br .fi .nf \fBsession_cache_key()\fR\& = {partial_key(), ssl:session_id()} .br .fi .RS .LP A key to an entry in the session cache\&. .RE .nf \fBpartial_key()\fR\& .br .fi .RS .LP The opaque part of the key\&. Does not need to be handled by the callback\&. .RE .nf \fBsession()\fR\& .br .fi .RS .LP The session data that is stored for each session\&. .RE .SH EXPORTS .LP .B Module:delete(Cache, Key) -> _ .br .RS .LP Types: .RS 3 Cache = session_cache_ref() .br Key = session_cache_key() .br .RE .RE .RS .LP Deletes a cache entry\&. Is only called from the cache handling process\&. .RE .LP .B Module:foldl(Fun, Acc0, Cache) -> Acc .br .RS .LP Types: .RS 3 Fun = fun() .br Acc0 = Acc = term() .br Cache = session_cache_ref() .br .RE .RE .RS .LP Calls \fIFun(Elem, AccIn)\fR\& on successive elements of the cache, starting with \fIAccIn == Acc0\fR\&\&. \fIFun/2\fR\& must return a new accumulator, which is passed to the next call\&. The function returns the final value of the accumulator\&. \fIAcc0\fR\& is returned if the cache is empty\&. .LP .RS -4 .B Note: .RE Since OTP-23\&.3 this functions is only used on the client side and does not need to implemented for a server cache\&. .RE .LP .B Module:init(Args) -> Cache .br .RS .LP Types: .RS 3 Cache = session_cache_ref() .br Args = proplists:proplist() .br .RE .RE .RS .LP Includes property \fI{role, client | server}\fR\&\&. Currently this is the only predefined property, there can also be user-defined properties\&. See also application environment variable session_cb_init_args\&. .LP Performs possible initializations of the cache and returns a reference to it that is used as parameter to the other API functions\&. Is called by the cache handling processes \fIinit\fR\& function, hence putting the same requirements on it as a normal process \fIinit\fR\& function\&. This function is called twice when starting the SSL application, once with the role client and once with the role server, as the SSL application must be prepared to take on both roles\&. .RE .LP .B Module:lookup(Cache, Key) -> Entry .br .RS .LP Types: .RS 3 Cache = session_cache_ref() .br Key = session_cache_key() .br Session = session() | undefined .br .RE .RE .RS .LP Looks up a cache entry\&. Is to be callable from any process\&. .RE .LP .B Module:select_session(Cache, PartialKey) -> [Session] .br .RS .LP Types: .RS 3 Cache = session_cache_ref() .br PartialKey = partial_key() .br Session = session() .br .RE .RE .RS .LP Selects sessions that can be reused, that is sessions that include \fIPartialKey\fR\& in its key\&. Is to be callable from any process\&. .LP .RS -4 .B Note: .RE Since OTP-23\&.3 This functions is only used on the client side and does not need to implemented for a server cache\&. .RE .LP .B Module:size(Cache) -> integer() .br .RS .LP Types: .RS 3 Cache = session_cache_ref() .br .RE .RE .RS .LP Returns the number of sessions in the cache\&. If size exceeds the maximum number of sessions, the current cache entries will be invalidated regardless of their remaining lifetime\&. Is to be callable from any process\&. .RE .LP .B Module:terminate(Cache) -> _ .br .RS .LP Types: .RS 3 Cache = session_cache_ref() .br .RS 2 As returned by init/0 .RE .RE .RE .RS .LP Takes care of possible cleanup that is needed when the cache handling process terminates\&. .RE .LP .B Module:update(Cache, Key, Session) -> _ .br .RS .LP Types: .RS 3 Cache = session_cache_ref() .br Key = session_cache_key() .br Session = session() .br .RE .RE .RS .LP Caches a new session or updates an already cached one\&. Is only called from the cache handling process\&. .RE