blob: b1f8ba88a3b86e0d1f894e07c64402397c339180 [file] [log] [blame]
// 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 "net/cert/pki/mock_signature_verify_cache.h"
#include <algorithm>
namespace net {
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 net