Interface IRedbObjectCache
Interface for caching WHOLE RedbObject objects (not just Props!)
Cache key = objectId, Hash is used for validity validation
Cache entire object with base fields + Props for:
0 DB queries on Cache HIT (without SELECT base fields)
Reuse of nested RedbObject through references (memory savings)
public interface IRedbObjectCache
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)
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 from cache by objectId with hash validation
RedbObject<TProps>? Get<TProps>(long objectId, Guid currentHash) where TProps : class, new()
GetWithoutHashValidation<TProps>(long)
Get WHOLE RedbObject from cache by objectId WITHOUT hash validation
RedbObject<TProps>? GetWithoutHashValidation<TProps>(long objectId) where TProps : class, new()
Set<TProps>(RedbObject<TProps>)
Save WHOLE RedbObject to cache
void Set<TProps>(RedbObject<TProps> obj) where TProps : class, new()