From d03e424d510e4596525bbf2039f7e793f45af6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinhagen?= Date: Wed, 1 Apr 2026 09:42:28 +0200 Subject: [PATCH] feat(all): adds disable cache functionality --- .../Bindings/SendOperationManager.cs | 18 ++++++++++++------ .../Settings/ConfigStore.cs | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/SendOperationManager.cs b/DUI3/Speckle.Connectors.DUI/Bindings/SendOperationManager.cs index 069b661a3..5086f47fb 100644 --- a/DUI3/Speckle.Connectors.DUI/Bindings/SendOperationManager.cs +++ b/DUI3/Speckle.Connectors.DUI/Bindings/SendOperationManager.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Cancellation; using Speckle.Connectors.Common.Extensions; using Speckle.Connectors.Common.Operations; @@ -7,6 +8,7 @@ using Speckle.Connectors.DUI.Exceptions; using Speckle.Connectors.DUI.Logging; using Speckle.Connectors.DUI.Models; using Speckle.Connectors.DUI.Models.Card; +using Speckle.Connectors.DUI.Settings; using Speckle.InterfaceGenerator; using Speckle.Sdk; using Speckle.Sdk.Api; @@ -37,8 +39,7 @@ public sealed class SendOperationManager( Func> gatherObjects, string? fileName, long? fileSizeBytes - ) - { + ) => await Process( commands, modelCardId, @@ -47,7 +48,6 @@ public sealed class SendOperationManager( fileName, fileSizeBytes ); - } public async Task Process( ISendBindingUICommands commands, @@ -56,8 +56,7 @@ public sealed class SendOperationManager( Func>> gatherObjects, string? fileName, long? fileSizeBytes - ) - { + ) => await Process( commands, modelCardId, @@ -66,7 +65,6 @@ public sealed class SendOperationManager( fileName, fileSizeBytes ); - } public async Task Process( ISendBindingUICommands commands, @@ -92,6 +90,14 @@ public sealed class SendOperationManager( initializeScope(serviceScope.ServiceProvider, modelCard); + // if user has disabled cache, wipe the in-memory cache before gathering and building objects + var configStore = serviceScope.ServiceProvider.GetRequiredService(); + if (configStore.GetConnectorConfig().DisableCache) + { + var sendConversionCache = serviceScope.ServiceProvider.GetRequiredService(); + sendConversionCache.ClearCache(); + } + var progress = operationProgressManager.CreateOperationProgressEventHandler( commands.Bridge, modelCardId, diff --git a/DUI3/Speckle.Connectors.DUI/Settings/ConfigStore.cs b/DUI3/Speckle.Connectors.DUI/Settings/ConfigStore.cs index 79c7da47e..5ae4befa8 100644 --- a/DUI3/Speckle.Connectors.DUI/Settings/ConfigStore.cs +++ b/DUI3/Speckle.Connectors.DUI/Settings/ConfigStore.cs @@ -165,6 +165,8 @@ public sealed class ConnectorConfig { public bool DarkTheme { get; init; } = true; + public bool DisableCache { get; init; } + /// /// Only used by Revit Connector !! /// We're exposing some settings to disable event listening inorder to debug app crash issues caused by Revit event handlers