olp-cpp-sdk
1.22.0
|
Settings for memory and disk caching. More...
#include <CacheSettings.h>
Public Attributes | |
boost::optional< std::string > | disk_path_mutable = boost::none |
The path to the mutable (read-write) disk cache where the SDK caches and lookups the content. More... | |
std::uint64_t | max_disk_storage = 1024ull * 1024ull * 32ull |
Sets the upper limit (in bytes) of the disk space that is used for persistent stores. More... | |
size_t | max_chunk_size = 1024u * 1024u * 32u |
Sets the upper limit of the runtime memory (in bytes) before it is written to the disk. More... | |
bool | enforce_immediate_flush = true |
Sets the flag to indicate that continuous flushes to the disk are necessary to preserve maximum data between the ignition cycles. | |
size_t | max_file_size = 1024u * 1024u * 2u |
Sets the maximum permissible size of one file in the storage (in bytes). More... | |
size_t | max_memory_cache_size = 1024u * 1024u |
Sets the upper limit of the memory data cache size (in bytes). More... | |
OpenOptions | openOptions = OpenOptions::Default |
Sets the disk cache open options. | |
EvictionPolicy | eviction_policy = EvictionPolicy::kLeastRecentlyUsed |
This flag sets the eviction policy for the key/value cache created based on the disk_path_mutable path. More... | |
CompressionType | compression = CompressionType::kDefaultCompression |
This flag sets the compression policy to be applied on the database. More... | |
boost::optional< std::string > | disk_path_protected = boost::none |
The path to the protected (read-only) cache. More... | |
bool | extend_permissions = false |
The extend permissions flag (applicable for Unix systems). More... | |
Settings for memory and disk caching.
CompressionType olp::cache::CacheSettings::compression = CompressionType::kDefaultCompression |
This flag sets the compression policy to be applied on the database.
In some cases though, when all the data to be inserted is already compressed by any means, e.g. protobuf or other serialization protocols, it might not be worth to enable any compression at all as it will eat up some CPU to compress and decompress the metadata without major gain. This parameter is dynamic and can be changed between runs. If changed only new values which are added will be using the new compression policy all existing entries will remain unchanged. The default value is CompressionType::kDefaultCompression.
boost::optional<std::string> olp::cache::CacheSettings::disk_path_mutable = boost::none |
The path to the mutable (read-write) disk cache where the SDK caches and lookups the content.
You should have write permissions.
If this parameter is not set, the downloaded data is stored only in the memory cache that is limited by #max_memory_cache_size
.
boost::optional<std::string> olp::cache::CacheSettings::disk_path_protected = boost::none |
The path to the protected (read-only) cache.
This cache will be used as the primary source for data lookup. The DefaultCache
will try to open this cache in the r/w mode to make sure the database can perform on-open optimizations like write-ahead logging (WAL) committing or compaction. In case we do not have permission to write on the provided path, or user set explicitly ReadOnly in the CacheSettings::openOptions
, the protected cache will be opened in r/o mode. In both cases the database will not be opened and user will receive a ProtectedCacheCorrupted
from DefaultCache::Open
in case the database has after open still an un-commited WAL, is uncompressed or cannot guarantee a normal operation and RAM usage. Use this cache if you want to have a stable fallback state or offline data that you can always access regardless of the network state.
EvictionPolicy olp::cache::CacheSettings::eviction_policy = EvictionPolicy::kLeastRecentlyUsed |
This flag sets the eviction policy for the key/value cache created based on the disk_path_mutable path.
This flag will not have any effect in case the disk_path_mutable is not specified and in case max_disk_storage is set to -1. The default value is EvictionPolicy::kLeastRecentlyUsed.
bool olp::cache::CacheSettings::extend_permissions = false |
The extend permissions flag (applicable for Unix systems).
A boolean option that controls the default permission for file and directory creation. When enabled, all permissions for files and directories will be set to 0666 and 0777 respectively, which allows read, write, and execute access to all users.
Note: the resulting permissions are affected by the umask.
size_t olp::cache::CacheSettings::max_chunk_size = 1024u * 1024u * 32u |
Sets the upper limit of the runtime memory (in bytes) before it is written to the disk.
Larger values increase performance, especially during bulk loads. Up to two write buffers may be held in memory at the same time, so you may wish to adjust this parameter to control memory usage. Also, a larger write buffer will result in a longer recovery time the next time the database is opened. The default value is 32 MB.
std::uint64_t olp::cache::CacheSettings::max_disk_storage = 1024ull * 1024ull * 32ull |
Sets the upper limit (in bytes) of the disk space that is used for persistent stores.
The default value is 32 MB. To never evict data, set max_disk_storage
to std::uint64_t(-1)
.
size_t olp::cache::CacheSettings::max_file_size = 1024u * 1024u * 2u |
Sets the maximum permissible size of one file in the storage (in bytes).
The default value is 2 MB.
size_t olp::cache::CacheSettings::max_memory_cache_size = 1024u * 1024u |
Sets the upper limit of the memory data cache size (in bytes).
If set to 0
, the memory cache is not used. The default value is 1 MB.