proxygen
wangle::ThreadSafeSSLSessionCache Class Reference

#include <ThreadSafeSSLSessionCache.h>

Inheritance diagram for wangle::ThreadSafeSSLSessionCache:
wangle::SSLSessionCallbacks

Public Member Functions

 ThreadSafeSSLSessionCache (std::unique_ptr< SSLSessionCallbacks > delegate)
 
void setSSLSession (const std::string &identity, SSLSessionPtr session) noexceptoverride
 
SSLSessionPtr getSSLSession (const std::string &identity) const noexceptoverride
 
bool removeSSLSession (const std::string &identity) noexceptoverride
 
bool supportsPersistence () const noexceptoverride
 
size_t size () const override
 
- Public Member Functions inherited from wangle::SSLSessionCallbacks
virtual ~SSLSessionCallbacks ()
 

Private Attributes

std::unique_ptr< SSLSessionCallbacksdelegate_
 
folly::SharedMutex mutex_
 

Additional Inherited Members

- Static Public Member Functions inherited from wangle::SSLSessionCallbacks
static void attachCallbacksToContext (SSL_CTX *ctx, SSLSessionCallbacks *callbacks)
 
static void detachCallbacksFromContext (SSL_CTX *ctx, SSLSessionCallbacks *callbacks)
 
static SSLSessionCallbacksgetCacheFromContext (SSL_CTX *ctx)
 

Detailed Description

A SSL session cache that can be used safely across threads. This is useful for clients who cannot avoid sharing the cache across threads. It uses a read/write lock for efficiency.

Definition at line 30 of file ThreadSafeSSLSessionCache.h.

Constructor & Destructor Documentation

wangle::ThreadSafeSSLSessionCache::ThreadSafeSSLSessionCache ( std::unique_ptr< SSLSessionCallbacks delegate)
inlineexplicit

Definition at line 32 of file ThreadSafeSSLSessionCache.h.

References getSSLSession(), folly::pushmi::__adl::noexcept(), removeSSLSession(), setSSLSession(), size(), string, and supportsPersistence().

33  :
34  delegate_(std::move(delegate)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< SSLSessionCallbacks > delegate_

Member Function Documentation

SSLSessionPtr wangle::ThreadSafeSSLSessionCache::getSSLSession ( const std::string identity) const
overridevirtualnoexcept

Implements wangle::SSLSessionCallbacks.

Definition at line 29 of file ThreadSafeSSLSessionCache.cpp.

References folly::detail::lock(), and mutex_.

Referenced by ThreadSafeSSLSessionCache().

30  {
32  return delegate_->getSSLSession(identity);
33 }
auto lock(SynchronizedLocker...lockersIn) -> std::tuple< typename SynchronizedLocker::LockedPtr... >
Definition: Synchronized.h:871
std::unique_ptr< SSLSessionCallbacks > delegate_
bool wangle::ThreadSafeSSLSessionCache::removeSSLSession ( const std::string identity)
overridevirtualnoexcept

Implements wangle::SSLSessionCallbacks.

Definition at line 35 of file ThreadSafeSSLSessionCache.cpp.

References folly::detail::lock(), and mutex_.

Referenced by ThreadSafeSSLSessionCache().

36  {
38  return delegate_->removeSSLSession(identity);
39 }
auto lock(SynchronizedLocker...lockersIn) -> std::tuple< typename SynchronizedLocker::LockedPtr... >
Definition: Synchronized.h:871
std::unique_ptr< SSLSessionCallbacks > delegate_
void wangle::ThreadSafeSSLSessionCache::setSSLSession ( const std::string identity,
SSLSessionPtr  session 
)
overridevirtualnoexcept

Implements wangle::SSLSessionCallbacks.

Definition at line 22 of file ThreadSafeSSLSessionCache.cpp.

References folly::detail::lock(), folly::gen::move, and mutex_.

Referenced by ThreadSafeSSLSessionCache().

24  {
26  delegate_->setSSLSession(identity, std::move(session));
27 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
auto lock(SynchronizedLocker...lockersIn) -> std::tuple< typename SynchronizedLocker::LockedPtr... >
Definition: Synchronized.h:871
std::unique_ptr< SSLSessionCallbacks > delegate_
size_t wangle::ThreadSafeSSLSessionCache::size ( ) const
overridevirtual

Reimplemented from wangle::SSLSessionCallbacks.

Definition at line 46 of file ThreadSafeSSLSessionCache.cpp.

References delegate_, folly::detail::lock(), and mutex_.

Referenced by ThreadSafeSSLSessionCache().

46  {
48  return delegate_->size();
49 }
auto lock(SynchronizedLocker...lockersIn) -> std::tuple< typename SynchronizedLocker::LockedPtr... >
Definition: Synchronized.h:871
std::unique_ptr< SSLSessionCallbacks > delegate_
bool wangle::ThreadSafeSSLSessionCache::supportsPersistence ( ) const
overridevirtualnoexcept

Reimplemented from wangle::SSLSessionCallbacks.

Definition at line 41 of file ThreadSafeSSLSessionCache.cpp.

References delegate_, folly::detail::lock(), and mutex_.

Referenced by ThreadSafeSSLSessionCache().

41  {
43  return delegate_->supportsPersistence();
44 }
auto lock(SynchronizedLocker...lockersIn) -> std::tuple< typename SynchronizedLocker::LockedPtr... >
Definition: Synchronized.h:871
std::unique_ptr< SSLSessionCallbacks > delegate_

Member Data Documentation

std::unique_ptr<SSLSessionCallbacks> wangle::ThreadSafeSSLSessionCache::delegate_
private

Definition at line 46 of file ThreadSafeSSLSessionCache.h.

Referenced by size(), and supportsPersistence().

folly::SharedMutex wangle::ThreadSafeSSLSessionCache::mutex_
mutableprivate

Definition at line 47 of file ThreadSafeSSLSessionCache.h.

Referenced by size(), and supportsPersistence().


The documentation for this class was generated from the following files: