Class RedbKeyGeneratorBase

Namespace: redb.Core.Data
Assembly: redb.Core.dll

Base class for key generation with caching.
Caching logic is database-agnostic, only SQL queries differ.
Static cache shared across all instances for thread-safety.

public abstract class RedbKeyGeneratorBase : IKeyGenerator

Inheritance

ObjectRedbKeyGeneratorBase

Implements

Derived

Methods

ClearCache()

Clear cache (for testing/reset).

public static void ClearCache()

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()

NextObjectIdBatchAsync(int)

Get batch of object IDs.

public Task<long[]> NextObjectIdBatchAsync(int count)

NextValueIdAsync()

Get next value ID (uses shared static cache).

public Task<long> NextValueIdAsync()

NextValueIdBatchAsync(int)

Get batch of value IDs.

public Task<long[]> NextValueIdBatchAsync(int count)

SetCacheSize(int)

Set cache size (default 10000).

public static void SetCacheSize(int size)