Cache Types
BlockCache vs RowCache
Creating a Cache
LRUCacheOptions
size_t
Total capacity of the cache in bytes.
int
Cache is sharded into 2^num_shard_bits shards by hash of key. If negative, a good default is chosen automatically.
bool
If true, Insert() fails when there is not enough capacity. If false, Insert() never fails.
double
Ratio of cache reserved for high-priority entries (0 to 1). 0.5 means non-high-priority entries use midpoint insertion.
MakeSharedCache
Returns a shared pointer to the created cache.
HyperClockCacheOptions
size_t
Estimated average charge per entry. 0 uses a dynamic-growing table variant. Non-zero uses the most efficient fixed-size variant.
int
Controls CPU vs memory tradeoff under stress. Higher values allow slightly more memory overhead to keep eviction performant.
Legacy Cache Creation Functions
NewLRUCache
Secondary Cache
CompressedSecondaryCacheOptions
CompressionType
Compression method for secondary cache entries.
CacheEntryRoleSet
Types of entries that should not be compressed. Filter blocks are non-compressible by default.
MakeSharedSecondaryCache
Tiered Cache
TieredCacheOptions
size_t
Total memory budget divided between primary and compressed secondary cache.
double
Ratio of total capacity allocated to compressed secondary cache (0.0 to 1.0).
NewTieredCache
UpdateTieredCache
Cache Entry Roles
Cache Metadata Charging
CacheMetadataChargePolicy
Only entry data counts against capacity.
CacheMetadataChargePolicy
Both entry data and cache overhead count against capacity. Default.