hierarchicalLocking function
Hierarchical Locking
Implementation
Future<void> hierarchicalLocking() async {
/// Parent resource lock
final IMutex parentMutex = MutexService().getMutex('document-123');
await parentMutex.protect(() async {
/// Now lock child resources
final IMutex childMutex = MutexService().getMutex('document-123-section-A');
await childMutex.protect(() async {
/// Operate on both parent and child safely
/// await updateDocumentAndSection();
});
});
}