Class GlobalPropsCache
Domain-isolated cache for WHOLE RedbObject (not just Props!).
Transparent to business code: if disabled (Cache == null), everything goes through DB.
Instance is bound to specific domain, static data is shared.
public sealed class GlobalPropsCache
Inheritance
Properties
Methods
FilterNeedToLoad<TProps>(List<(long objectId, Guid hash)>, out Dictionary<long, RedbObject<TProps>>)
BULK: determine which objects need to be loaded from DB (set difference).
public HashSet<long> FilterNeedToLoad<TProps>(List<(long objectId, Guid hash)> objects, out Dictionary<long, RedbObject<TProps>> fromCache) where TProps : class, new()
Get<TProps>(long, Guid)
Get WHOLE RedbObject with hash validation.
public RedbObject<TProps>? Get<TProps>(long objectId, Guid hash) where TProps : class, new()
GetWithoutHashValidation<TProps>(long)
Get WHOLE RedbObject WITHOUT hash validation (for monolithic applications).
public RedbObject<TProps>? GetWithoutHashValidation<TProps>(long objectId) where TProps : class, new()
Initialize(IRedbObjectCache)
Initialize cache for this domain (called once at application startup per domain).
public void Initialize(IRedbObjectCache cache)
Set<TProps>(RedbObject<TProps>)
Save WHOLE RedbObject to cache.
public void Set<TProps>(RedbObject<TProps> obj) where TProps : class, new()
Constructors
GlobalPropsCache(string?)
Create cache instance for specific domain.