proxygen
SynchronizedLruPskCache.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
10 
11 namespace fizz {
12 namespace client {
13 
15  : cache_(EvictingPskMap(mapMax)) {}
16 
18  const std::string& identity) {
19  auto cacheMap = cache_.wlock();
20  auto result = cacheMap->find(identity);
21  if (result != cacheMap->end()) {
22  return result->second;
23  } else {
24  return folly::none;
25  }
26 }
27 
29  const std::string& identity,
30  CachedPsk psk) {
31  auto cacheMap = cache_.wlock();
32  cacheMap->set(identity, std::move(psk));
33 }
34 
36  auto cacheMap = cache_.wlock();
37  cacheMap->erase(identity);
38 }
39 
40 } // namespace client
41 } // namespace fizz
void putPsk(const std::string &identity, CachedPsk psk) override
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
folly::Synchronized< EvictingPskMap > cache_
folly::Optional< CachedPsk > getPsk(const std::string &identity) override
void removePsk(const std::string &identity) override
Definition: Actions.h:16
const char * string
Definition: Conv.cpp:212
constexpr None none
Definition: Optional.h:87