File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,23 @@ struct MemoryTierConfig : public JSONConfig {
4646
4747 explicit MemoryTierConfig (const folly::dynamic& configJson);
4848 MemoryTierCacheConfig getMemoryTierCacheConfig () {
49- if (file.empty ()) {
50- throw std::invalid_argument (" Please specify valid path to memory mapped file." );
51- }
52- MemoryTierCacheConfig config = MemoryTierCacheConfig::fromFile (file).setSize (size).setRatio (ratio);
49+ MemoryTierCacheConfig config = memoryTierCacheConfigFromSource ();
50+ config.setSize (size).setRatio (ratio);
5351 return config;
5452 }
5553
5654 std::string file{" " };
5755 size_t ratio{0 };
5856 size_t size{0 };
57+
58+ private:
59+ MemoryTierCacheConfig memoryTierCacheConfigFromSource () {
60+ if (file.empty ()) {
61+ return MemoryTierCacheConfig::fromShm ();
62+ } else {
63+ return MemoryTierCacheConfig::fromFile (file);
64+ }
65+ }
5966};
6067
6168struct CacheConfig : public JSONConfig {
You can’t perform that action at this time.
0 commit comments