olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
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#include <olp/core/porting/optional.h>
28
29namespace olp {
30namespace cache {
31
32#ifdef OLP_SDK_ENABLE_DEFAULT_CACHE
33
37enum OpenOptions : unsigned char {
38 Default = 0x00,
39 ReadOnly = 0x01,
40 CheckCrc = 0x02
41};
42
46enum class EvictionPolicy : unsigned char {
47 kNone,
48 kLeastRecentlyUsed
49};
50
54enum class CompressionType {
55 kNoCompression,
56 kDefaultCompression
58};
59
63struct CORE_API CacheSettings {
73 porting::optional<std::string> disk_path_mutable = porting::none;
74
82 std::uint64_t max_disk_storage = 1024ull * 1024ull * 32ull;
83
94 size_t max_chunk_size = 1024u * 1024u * 32u;
95
100 bool enforce_immediate_flush = true;
101
108 size_t max_file_size = 1024u * 1024u * 2u;
109
115 size_t max_memory_cache_size = 1024u * 1024u;
116
120 OpenOptions openOptions = OpenOptions::Default;
121
130 EvictionPolicy eviction_policy = EvictionPolicy::kLeastRecentlyUsed;
131
144 CompressionType compression = CompressionType::kDefaultCompression;
145
162 porting::optional<std::string> disk_path_protected = porting::none;
163
174 bool extend_permissions = false;
175};
176
177#else
178
182struct CORE_API CacheSettings {};
183
184#endif // OLP_SDK_ENABLE_DEFAULT_CACHE
185
186} // namespace cache
187} // namespace olp
Rules all the other namespaces.
Definition AppleSignInProperties.h:24
Settings for memory and disk caching.
Definition CacheSettings.h:63