aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src/ssl_session_cache.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2015-11-16 21:58:36 +0100
committerIngela Anderton Andin <[email protected]>2015-12-03 15:54:34 +0100
commit42b8a29dbae1d626f32bc16dd81a129caf741138 (patch)
tree34773d2d761aced6cf626bb312c8041a1ecc0be6 /lib/ssl/src/ssl_session_cache.erl
parent5e95fdff6589432327e38415fc9c5545231e7961 (diff)
downloadotp-42b8a29dbae1d626f32bc16dd81a129caf741138.tar.gz
otp-42b8a29dbae1d626f32bc16dd81a129caf741138.tar.bz2
otp-42b8a29dbae1d626f32bc16dd81a129caf741138.zip
ssl: Add upper limit for session cache
If upper limit is reached invalidate the current cache entries, e.i the session lifetime is the max time a session will be keept, but it may be invalidated earlier if the max limit for the table is reached. This will keep the ssl manager process well behaved, not exhusting memeory. Invalidating the entries will incrementally empty the cache to make room for fresh sessions entries.
Diffstat (limited to 'lib/ssl/src/ssl_session_cache.erl')
-rw-r--r--lib/ssl/src/ssl_session_cache.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ssl/src/ssl_session_cache.erl b/lib/ssl/src/ssl_session_cache.erl
index cfc48cd935..9585e613e6 100644
--- a/lib/ssl/src/ssl_session_cache.erl
+++ b/lib/ssl/src/ssl_session_cache.erl
@@ -27,7 +27,7 @@
-include("ssl_internal.hrl").
-export([init/1, terminate/1, lookup/2, update/3, delete/2, foldl/3,
- select_session/2]).
+ select_session/2, size/1]).
%%--------------------------------------------------------------------
%% Description: Return table reference. Called by ssl_manager process.
@@ -86,6 +86,12 @@ select_session(Cache, PartialKey) ->
[{{{PartialKey,'_'}, '$1'},[],['$1']}]).
%%--------------------------------------------------------------------
+%% Description: Returns the cache size
+%%--------------------------------------------------------------------
+size(Cache) ->
+ ets:info(Cache, size).
+
+%%--------------------------------------------------------------------
%%% Internal functions
%%--------------------------------------------------------------------
cache_name(Name) ->