feat(all): adds disable cache functionality

This commit is contained in:
Björn Steinhagen
2026-04-01 09:42:28 +02:00
parent 3be24d5b15
commit d03e424d51
2 changed files with 14 additions and 6 deletions
@@ -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<SenderModelCard, IReadOnlyList<T>> gatherObjects,
string? fileName,
long? fileSizeBytes
)
{
) =>
await Process(
commands,
modelCardId,
@@ -47,7 +48,6 @@ public sealed class SendOperationManager(
fileName,
fileSizeBytes
);
}
public async Task Process<T>(
ISendBindingUICommands commands,
@@ -56,8 +56,7 @@ public sealed class SendOperationManager(
Func<SenderModelCard, Task<IReadOnlyList<T>>> gatherObjects,
string? fileName,
long? fileSizeBytes
)
{
) =>
await Process(
commands,
modelCardId,
@@ -66,7 +65,6 @@ public sealed class SendOperationManager(
fileName,
fileSizeBytes
);
}
public async Task Process<T>(
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<IConfigStore>();
if (configStore.GetConnectorConfig().DisableCache)
{
var sendConversionCache = serviceScope.ServiceProvider.GetRequiredService<ISendConversionCache>();
sendConversionCache.ClearCache();
}
var progress = operationProgressManager.CreateOperationProgressEventHandler(
commands.Bridge,
modelCardId,
@@ -165,6 +165,8 @@ public sealed class ConnectorConfig
{
public bool DarkTheme { get; init; } = true;
public bool DisableCache { get; init; }
/// <remarks>
/// 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