| 1091 | class EndpointProviderCache { |
| 1092 | public: |
| 1093 | std::shared_ptr<Aws::S3::S3EndpointProviderBase> Lookup( |
| 1094 | const Aws::S3::S3ClientConfiguration& config) { |
| 1095 | auto key = EndpointConfigKey(config); |
| 1096 | CacheValue* value; |
| 1097 | { |
| 1098 | std::unique_lock lock(mutex_); |
| 1099 | value = &cache_[std::move(key)]; |
| 1100 | } |
| 1101 | std::call_once(value->once, [&]() { |
| 1102 | auto endpoint_provider = std::make_shared<Aws::S3::S3EndpointProvider>(); |
| 1103 | endpoint_provider->InitBuiltInParameters(config); |
| 1104 | value->endpoint_provider = |
| 1105 | std::make_shared<InitOnceEndpointProvider>(std::move(endpoint_provider)); |
| 1106 | }); |
| 1107 | return value->endpoint_provider; |
| 1108 | } |
| 1109 | |
| 1110 | void Reset() { |
| 1111 | std::unique_lock lock(mutex_); |
no test coverage detected