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