diff options
Diffstat (limited to 'cache/cache.cc')
-rw-r--r-- | cache/cache.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/cache/cache.cc b/cache/cache.cc index 3dbea128e..cf5febb70 100644 --- a/cache/cache.cc +++ b/cache/cache.cc @@ -133,19 +133,23 @@ Status Cache::CreateFromString(const ConfigOptions& config_options, std::shared_ptr<Cache>* result) { Status status; std::shared_ptr<Cache> cache; - if (value.find('=') == std::string::npos) { - cache = NewLRUCache(ParseSizeT(value)); - } else { - LRUCacheOptions cache_opts; - status = OptionTypeInfo::ParseStruct(config_options, "", - &lru_cache_options_type_info, "", - value, &cache_opts); + if (value.find("://") == std::string::npos) { + if (value.find('=') == std::string::npos) { + cache = NewLRUCache(ParseSizeT(value)); + } else { + LRUCacheOptions cache_opts; + status = OptionTypeInfo::ParseStruct(config_options, "", + &lru_cache_options_type_info, "", + value, &cache_opts); + if (status.ok()) { + cache = NewLRUCache(cache_opts); + } + } if (status.ok()) { - cache = NewLRUCache(cache_opts); + result->swap(cache); } - } - if (status.ok()) { - result->swap(cache); + } else { + status = LoadSharedObject<Cache>(config_options, value, result); } return status; } |