blob: d99f6902dccb9b222cd85362a7f2cfea87b8db77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mock_signature_verify_cache.h"
#include <algorithm>
namespace bssl {
MockSignatureVerifyCache::MockSignatureVerifyCache() = default;
MockSignatureVerifyCache::~MockSignatureVerifyCache() = default;
void MockSignatureVerifyCache::Store(const std::string &key,
SignatureVerifyCache::Value value) {
cache_.insert_or_assign(key, value);
stores_++;
}
SignatureVerifyCache::Value MockSignatureVerifyCache::Check(
const std::string &key) {
auto iter = cache_.find(key);
if (iter == cache_.end()) {
misses_++;
return SignatureVerifyCache::Value::kUnknown;
}
hits_++;
return iter->second;
}
} // namespace bssl
|