Class GlobalMetadataCache

Assembly: redb.Core.dll

Metadata cache with domain isolation.
Combines scheme caching and CLR type registry (former AutomaticTypeRegistry).
Instance is bound to specific domain, static data is shared.
Each domain (typically one per database connection) has isolated cache.

public class GlobalMetadataCache

Inheritance

ObjectGlobalMetadataCache

Properties

Domain

Cache domain this instance is bound to.

public string Domain { get; }

HasTypesByIdCache

Check if types by ID cache has data.

public bool HasTypesByIdCache { get; }

IsClrTypeRegistryInitialized

Check if CLR type registry is initialized for this domain.

public bool IsClrTypeRegistryInitialized { get; }

IsEnabled

Is caching enabled for this domain.

public bool IsEnabled { get; }

Methods

CacheScheme(IRedbScheme)

Cache scheme.

public void CacheScheme(IRedbScheme scheme)

CacheType(string, long)

Cache type ID.

public void CacheType(string typeName, long typeId)

CacheTypesById(IEnumerable<RedbTypeInfo>)

Bulk cache types by ID.

public void CacheTypesById(IEnumerable<RedbTypeInfo> types)

Clear()

Clear cache for this domain.

public void Clear()

ClearAll()

Clear all domain caches.

public static void ClearAll()

ClearDomain(string)

Clear cache for specific domain.

public static void ClearDomain(string domain)

GetAllDomains()

Get list of all registered domains.

public static IReadOnlyCollection<string> GetAllDomains()

GetClrType(long)

Get C# type by scheme ID.

public Type? GetClrType(long schemeId)

GetClrType(string)

Get C# type by scheme name.

public Type? GetClrType(string schemeName)

GetClrTypeStatistics()

Get CLR type registry statistics.

public (int SchemeNames, int SchemeIds) GetClrTypeStatistics()

GetDiagnosticInfo()

Get diagnostic information.

public string GetDiagnosticInfo()

GetScheme(long)

Get scheme by ID from cache.

public IRedbScheme? GetScheme(long schemeId)

GetScheme(string)

Get scheme by name from cache.

public IRedbScheme? GetScheme(string schemeName)

GetSchemeIdByClrType(Type)

Get scheme_id by C# type.

public long? GetSchemeIdByClrType(Type type)

GetStatistics()

Get cache statistics for this domain.

public CacheStatistics GetStatistics()

GetTypeById(long)

Get type info by ID.

public RedbTypeInfo? GetTypeById(long typeId)

GetTypeId(string)

Get type ID from cache.

public long? GetTypeId(string typeName)

Initialize(RedbServiceConfiguration)

Initialize cache settings from configuration.

public void Initialize(RedbServiceConfiguration configuration)

InitializeClrTypeRegistryAsync(ISchemeSyncProvider, ILogger?)

Initialize CLR type registry by scanning assemblies with RedbSchemeAttribute.

public Task InitializeClrTypeRegistryAsync(ISchemeSyncProvider schemeProvider, ILogger? logger = null)

InvalidateScheme(long)

Invalidate scheme by ID.

public void InvalidateScheme(long schemeId)

InvalidateScheme(string)

Invalidate scheme by name.

public void InvalidateScheme(string schemeName)

RegisterClrType(string, long, Type)

Register CLR type mapping manually.

public void RegisterClrType(string schemeName, long schemeId, Type type)

ResetAllStatistics()

Reset statistics for all domains (static utility).

public static void ResetAllStatistics()

ResetStatistics()

Reset statistics for this domain.

public void ResetStatistics()

SetEnabled(bool)

Enable/disable caching for this domain.

public void SetEnabled(bool enabled)

Constructors

GlobalMetadataCache(RedbServiceConfiguration)

Creates cache instance with domain from configuration.

GlobalMetadataCache(string?)

Creates cache instance bound to specific domain.