Table of Contents

Class HyperClockCacheOptions

Namespace
RocksDbNet
Assembly
RocksDb.Net.dll

Settings for a HyperClock block cache. Maps to rocksdb_hyper_clock_cache_options_t.

public sealed class HyperClockCacheOptions : RocksDbHandle, IDisposable
Inheritance
HyperClockCacheOptions
Implements
Inherited Members

Remarks

See CreateHyperClock(ulong, ulong) for what distinguishes this cache from the LRU one. RocksDb copies these when the cache is created, so this object may be disposed straight afterwards.

Constructors

HyperClockCacheOptions(ulong, ulong)

Creates options for a cache of the given size.

public HyperClockCacheOptions(ulong capacityBytes, ulong estimatedEntryCharge = 0)

Parameters

capacityBytes ulong

Total cache capacity in bytes.

estimatedEntryCharge ulong

Rough average size of a cached entry in bytes, or zero to let RocksDb adapt. See EstimatedEntryCharge.

Properties

Capacity

Total cache capacity in bytes. Write-only.

public ulong Capacity { set; }

Property Value

ulong

EstimatedEntryCharge

Rough average size of a cached entry in bytes, or zero to let RocksDb adapt. Write-only.

public ulong EstimatedEntryCharge { set; }

Property Value

ulong

Remarks

HyperClock trades the LRU cache's per-shard locking for a fixed-size table, and it needs an entry-size estimate to size that table. A wildly wrong estimate wastes capacity or causes premature eviction, so zero, which lets RocksDb work it out, is the safer default.

NumShardBits

Base-2 logarithm of the shard count. Negative lets RocksDb choose. Write-only.

public int NumShardBits { set; }

Property Value

int

Methods

DisposeHandle()

Releases the native handle. Called during disposal.

protected override void DisposeHandle()

Remarks

Protected rather than public: it destroys the native object without marking this instance disposed or clearing the handle, so calling it from outside and then disposing normally would free the same pointer twice. It was the most Dispose-looking member on the type. Callers want Dispose().