Class RedbKeyGeneratorBase
Base class for key generation with domain-isolated caching.
Each domain (typically one per database connection) has isolated cache.
Instance is bound to specific domain, static data is shared.
public abstract class RedbKeyGeneratorBase : IKeyGenerator
Inheritance
Implements
Derived
Properties
IssuedHighWater
The highest id this process has handed out for this domain (), 0 before the first.
protected long IssuedHighWater { get; }
Methods
GenerateKeysAsync(int)
Generate batch of keys from database sequence.
protected abstract Task<List<long>> GenerateKeysAsync(int count)
NextObjectIdAsync()
Get next object ID (uses shared static cache).
public Task<long> NextObjectIdAsync()
NextObjectIdAsync(CancellationToken)
Get next object ID (uses shared static cache).
public Task<long> NextObjectIdAsync(CancellationToken cancellationToken = default)
NextObjectIdBatchAsync(int, CancellationToken)
Get batch of object IDs.
public Task<long[]> NextObjectIdBatchAsync(int count, CancellationToken cancellationToken = default)
NextObjectIdBatchAsync(int)
Get batch of object IDs.
public Task<long[]> NextObjectIdBatchAsync(int count)
NextValueIdAsync(CancellationToken)
Get next value ID (uses shared static cache).
public Task<long> NextValueIdAsync(CancellationToken cancellationToken = default)
NextValueIdBatchAsync(int, CancellationToken)
Get batch of value IDs.
public Task<long[]> NextValueIdBatchAsync(int count, CancellationToken cancellationToken = default)
NextValueIdBatchAsync(int)
Get batch of value IDs.
public Task<long[]> NextValueIdBatchAsync(int count)
RecordIssued(long)
Raises to top, the highest id of a range just handed out.
protected void RecordIssued(long top)
TryGenerateKeysInAmbientTransactionAsync(int)
Provider hook for a refill that must not use a SEPARATE connection, bypassing the shared cache:
protected virtual Task<List<long>?> TryGenerateKeysInAmbientTransactionAsync(int count)