| 11 | { |
| 12 | |
| 13 | void PlanCacheManager::initialize(ContextMutablePtr context) |
| 14 | { |
| 15 | if (!context->getPlanCacheManager()) |
| 16 | { |
| 17 | auto manager_instance = std::make_unique<PlanCacheManager>(); |
| 18 | context->setPlanCacheManager(std::move(manager_instance)); |
| 19 | } |
| 20 | |
| 21 | auto * manager_instance = context->getPlanCacheManager(); |
| 22 | if (manager_instance->cache) |
| 23 | { |
| 24 | LOG_WARNING(&Poco::Logger::get("PlanCacheManager"), "PlanCacheManager already initialized"); |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | auto max_size = context->getConfigRef().getUInt64("optimizer.plancache.max_cache_size", PlanCacheConfig::max_cache_size); |
| 29 | auto expire_time = std::chrono::seconds( |
| 30 | context->getConfigRef().getUInt64("optimizer.plancache.cache_expire_time", PlanCacheConfig::cache_expire_time)); |
| 31 | manager_instance->initialize(max_size, expire_time); |
| 32 | } |
| 33 | |
| 34 | void PlanCacheManager::initialize(UInt64 max_size, std::chrono::seconds expire_time) |
| 35 | { |
nothing calls this directly
no test coverage detected