proxygen
fizz::client::BasicPskCache Class Reference

#include <PskCache.h>

Inheritance diagram for fizz::client::BasicPskCache:
fizz::client::PskCache

Public Member Functions

 ~BasicPskCache () override=default
 
folly::Optional< CachedPskgetPsk (const std::string &identity) override
 
void putPsk (const std::string &identity, CachedPsk psk) override
 
void removePsk (const std::string &identity) override
 
- Public Member Functions inherited from fizz::client::PskCache
virtual ~PskCache ()=default
 

Private Attributes

std::unordered_map< std::string, CachedPskcache_
 

Detailed Description

Basic PSK cache that stores PSKs in a hash map. There is no bound on the size of this cache.

Definition at line 63 of file PskCache.h.

Constructor & Destructor Documentation

fizz::client::BasicPskCache::~BasicPskCache ( )
overridedefault

Member Function Documentation

folly::Optional<CachedPsk> fizz::client::BasicPskCache::getPsk ( const std::string identity)
inlineoverridevirtual

Retrieve a PSK for the specified identity.

Implements fizz::client::PskCache.

Definition at line 67 of file PskCache.h.

References folly::none.

67  {
68  auto result = cache_.find(identity);
69  if (result != cache_.end()) {
70  return result->second;
71  } else {
72  return folly::none;
73  }
74  }
std::unordered_map< std::string, CachedPsk > cache_
Definition: PskCache.h:85
constexpr None none
Definition: Optional.h:87
void fizz::client::BasicPskCache::putPsk ( const std::string identity,
CachedPsk   
)
inlineoverridevirtual

Add a new PSK for identity to the cache.

Implements fizz::client::PskCache.

Definition at line 76 of file PskCache.h.

References folly::gen::move.

76  {
77  cache_[identity] = std::move(psk);
78  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unordered_map< std::string, CachedPsk > cache_
Definition: PskCache.h:85
void fizz::client::BasicPskCache::removePsk ( const std::string identity)
inlineoverridevirtual

Remove any PSKs associated with identity from the cache.

Implements fizz::client::PskCache.

Definition at line 80 of file PskCache.h.

80  {
81  cache_.erase(identity);
82  }
std::unordered_map< std::string, CachedPsk > cache_
Definition: PskCache.h:85

Member Data Documentation

std::unordered_map<std::string, CachedPsk> fizz::client::BasicPskCache::cache_
private

Definition at line 85 of file PskCache.h.


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