Package tlslite :: Module sessioncache :: Class SessionCache
[hide private]
[frames] | no frames]

Class SessionCache

source code

object --+
         |
        SessionCache

This class is used by the server to cache TLS sessions.

Caching sessions allows the client to use TLS session resumption and avoid the expense of a full handshake. To use this class, simply pass a SessionCache instance into the server handshake function.

This class is thread-safe.

Instance Methods [hide private]
 
__getitem__(self, sessionID) source code
 
__init__(self, maxEntries=10000, maxAge=14400)
Create a new SessionCache.
source code
 
__setitem__(self, sessionID, session) source code
 
_purge(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, maxEntries=10000, maxAge=14400)
(Constructor)

source code 

Create a new SessionCache.

Parameters:
  • maxEntries (int) - The maximum size of the cache. When this limit is reached, the oldest sessions will be deleted as necessary to make room for new ones. The default is 10000.
  • maxAge (int) - The number of seconds before a session expires from the cache. The default is 14400 (i.e. 4 hours).
Overrides: object.__init__