Skip to content

Commit 43a44d6

Browse files
Added setting default size for default tier to match default cache size; deleted unused code.
1 parent 49c72f2 commit 43a44d6

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

cachelib/allocator/CacheAllocatorConfig.h

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,6 @@ class CacheAllocatorConfig {
212212
// this method will set it as a sum of all tier sizes
213213
CacheAllocatorConfig& configureMemoryTiers(const MemoryTierConfigs& configs);
214214

215-
// Sets total cache size and configures cache memory tiers. This method
216-
// can be used when configuring cache memory tiers whose sizes are specified
217-
// via ratios of total cache size. If tier sizes are specified explicitly
218-
// then the sum of tier sizes must match provided total cache size
219-
CacheAllocatorConfig& configureMemoryTiers(size_t totalCacheSize,
220-
const MemoryTierConfigs& configs);
221-
222215
// Return reference to MemoryTierCacheConfigs.
223216
const MemoryTierConfigs& getMemoryTierConfigs();
224217

@@ -606,7 +599,7 @@ class CacheAllocatorConfig {
606599

607600
// Configuration for memory tiers.
608601
MemoryTierConfigs memoryTierConfigs{
609-
{MemoryTierCacheConfig::fromShm().setRatio(1)}};
602+
{MemoryTierCacheConfig::fromShm().setRatio(1).setSize(size)}};
610603

611604
void mergeWithPrefix(
612605
std::map<std::string, std::string>& configMap,
@@ -890,17 +883,6 @@ CacheAllocatorConfig<T>& CacheAllocatorConfig<T>::enableItemReaperInBackground(
890883
return *this;
891884
}
892885

893-
template <typename T>
894-
CacheAllocatorConfig<T>& CacheAllocatorConfig<T>::configureMemoryTiers(
895-
size_t totalCacheSize, const MemoryTierConfigs& config) {
896-
setCacheSize(totalCacheSize);
897-
if (!getCacheSize()) {
898-
throw std::invalid_argument("Total cache size must be greater than 0.");
899-
}
900-
901-
return configureMemoryTiers(config);
902-
}
903-
904886
template <typename T>
905887
CacheAllocatorConfig<T>& CacheAllocatorConfig<T>::configureMemoryTiers(
906888
const MemoryTierConfigs& config) {

0 commit comments

Comments
 (0)