olp-cpp-sdk  1.22.0
CacheSettings.h
1 /*
2  * Copyright (C) 2019-2024 HERE Europe B.V.
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  * SPDX-License-Identifier: Apache-2.0
17  * License-Filename: LICENSE
18  */
19 
20 #pragma once
21 
22 #include <cstdint>
23 #include <string>
24 
25 #include <olp/core/Config.h>
26 #include <olp/core/CoreApi.h>
27 
28 #include <olp/core/porting/deprecated.h>
29 #include <boost/optional.hpp>
30 
31 namespace olp {
32 namespace cache {
33 
34 #ifdef OLP_SDK_ENABLE_DEFAULT_CACHE
35 
39 enum OpenOptions : unsigned char {
40  Default = 0x00,
41  ReadOnly = 0x01,
42  CheckCrc = 0x02
43 };
44 
48 enum class EvictionPolicy : unsigned char {
49  kNone,
50  kLeastRecentlyUsed
51 };
52 
56 enum class CompressionType {
57  kNoCompression,
58  kDefaultCompression
60 };
61 
65 struct CORE_API CacheSettings {
75  boost::optional<std::string> disk_path_mutable = boost::none;
76 
84  std::uint64_t max_disk_storage = 1024ull * 1024ull * 32ull;
85 
96  size_t max_chunk_size = 1024u * 1024u * 32u;
97 
102  bool enforce_immediate_flush = true;
103 
110  size_t max_file_size = 1024u * 1024u * 2u;
111 
117  size_t max_memory_cache_size = 1024u * 1024u;
118 
122  OpenOptions openOptions = OpenOptions::Default;
123 
132  EvictionPolicy eviction_policy = EvictionPolicy::kLeastRecentlyUsed;
133 
146  CompressionType compression = CompressionType::kDefaultCompression;
147 
164  boost::optional<std::string> disk_path_protected = boost::none;
165 
176  bool extend_permissions = false;
177 };
178 
179 #else
180 
184 struct CORE_API CacheSettings {};
185 
186 #endif // OLP_SDK_ENABLE_DEFAULT_CACHE
187 
188 } // namespace cache
189 } // namespace olp
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24
Settings for memory and disk caching.
Definition: CacheSettings.h:65