1 /* 2 * Copyright (c) Facebook, Inc. and its affiliates. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include <wangle/client/persistence/PersistentCacheCommon.h> 18 19 namespace wangle { 20 setCapacity(std::size_t cacheCapacity)21PersistentCacheConfig::Builder&& PersistentCacheConfig::Builder::setCapacity( 22 std::size_t cacheCapacity) && { 23 capacity = cacheCapacity; 24 return std::move(*this); 25 } 26 27 PersistentCacheConfig::Builder&& setSyncInterval(std::chrono::milliseconds interval)28PersistentCacheConfig::Builder::setSyncInterval( 29 std::chrono::milliseconds interval) && { 30 syncInterval = interval; 31 return std::move(*this); 32 } 33 setExecutor(std::shared_ptr<folly::Executor> executorIn)34PersistentCacheConfig::Builder&& PersistentCacheConfig::Builder::setExecutor( 35 std::shared_ptr<folly::Executor> executorIn) && { 36 executor = std::move(executorIn); 37 return std::move(*this); 38 } 39 40 PersistentCacheConfig::Builder&& setInlinePersistenceLoading(bool loadInline)41PersistentCacheConfig::Builder::setInlinePersistenceLoading( 42 bool loadInline) && { 43 inlinePersistenceLoading = loadInline; 44 return std::move(*this); 45 } 46 setSyncRetries(int retries)47PersistentCacheConfig::Builder&& PersistentCacheConfig::Builder::setSyncRetries( 48 int retries) && { 49 nSyncRetries = retries; 50 return std::move(*this); 51 } 52 build()53PersistentCacheConfig PersistentCacheConfig::Builder::build() && { 54 return PersistentCacheConfig( 55 capacity.value(), 56 syncInterval, 57 nSyncRetries, 58 std::move(executor), 59 inlinePersistenceLoading); 60 } 61 } // namespace wangle 62