From f0b170230b5d0e6ccce5cac896ac5f0cabf1dc89 Mon Sep 17 00:00:00 2001 From: Daniel Bohlin Date: Sat, 18 Apr 2026 13:19:50 +0200 Subject: [PATCH 1/5] update nuget packages --- Tharga.Cache.File.Tests/Tharga.Cache.File.Tests.csproj | 4 ++-- Tharga.Cache.MongoDB.Tests/Tharga.Cache.MongoDB.Tests.csproj | 4 ++-- Tharga.Cache.Redis.Tests/Tharga.Cache.Redis.Tests.csproj | 4 ++-- Tharga.Cache.Tests/Tharga.Cache.Tests.csproj | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tharga.Cache.File.Tests/Tharga.Cache.File.Tests.csproj b/Tharga.Cache.File.Tests/Tharga.Cache.File.Tests.csproj index 3136232..0cd2118 100644 --- a/Tharga.Cache.File.Tests/Tharga.Cache.File.Tests.csproj +++ b/Tharga.Cache.File.Tests/Tharga.Cache.File.Tests.csproj @@ -15,11 +15,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tharga.Cache.MongoDB.Tests/Tharga.Cache.MongoDB.Tests.csproj b/Tharga.Cache.MongoDB.Tests/Tharga.Cache.MongoDB.Tests.csproj index 579c85f..7c3d375 100644 --- a/Tharga.Cache.MongoDB.Tests/Tharga.Cache.MongoDB.Tests.csproj +++ b/Tharga.Cache.MongoDB.Tests/Tharga.Cache.MongoDB.Tests.csproj @@ -15,11 +15,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tharga.Cache.Redis.Tests/Tharga.Cache.Redis.Tests.csproj b/Tharga.Cache.Redis.Tests/Tharga.Cache.Redis.Tests.csproj index 0667623..112950a 100644 --- a/Tharga.Cache.Redis.Tests/Tharga.Cache.Redis.Tests.csproj +++ b/Tharga.Cache.Redis.Tests/Tharga.Cache.Redis.Tests.csproj @@ -15,11 +15,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tharga.Cache.Tests/Tharga.Cache.Tests.csproj b/Tharga.Cache.Tests/Tharga.Cache.Tests.csproj index 3b768db..fac71f4 100644 --- a/Tharga.Cache.Tests/Tharga.Cache.Tests.csproj +++ b/Tharga.Cache.Tests/Tharga.Cache.Tests.csproj @@ -15,11 +15,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 9e5f19136acd13e05ab6176ef693c9392bc9d8fe Mon Sep 17 00:00:00 2001 From: Daniel Bohlin Date: Sat, 18 Apr 2026 13:35:14 +0200 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20Blazor=20UI=20overhaul=20=E2=80=94?= =?UTF-8?q?=20slim=20ListView,=20detail=20dialog,=20persist=20type,=20live?= =?UTF-8?q?=20refresh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CacheTypeInfo: added PersistType field, populated by CacheMonitor.Set/Track from CacheOptions.Get().PersistType - ListView: slimmed columns to Key, Expires, Size, Load Time, Stale; added Persist column on the type-level grid (e.g. Memory, Redis, MongoDB, File); added chevron button per row to open detail dialog - DetailView: new Radzen dialog component showing all metadata plus cached data as pretty-printed JSON via IEternalCache.PeekAsync reflection; uses Tharga.Blazor CopyButton for copy-to-clipboard - SummaryView + ListView: subscribe to ICacheMonitor DataSetEvent/DataDropEvent for live refresh when cache changes (fixes "Clear Cache" not refreshing list) --- Tharga.Cache.Blazor/DetailView.razor | 125 ++++++++++++++++++++++++++ Tharga.Cache.Blazor/ListView.razor | 76 ++++++++++------ Tharga.Cache.Blazor/SummaryView.razor | 18 +++- Tharga.Cache/CacheTypeInfo.cs | 1 + Tharga.Cache/Core/CacheMonitor.cs | 4 + plan/feature.md | 25 ++++++ plan/plan.md | 8 ++ 7 files changed, 229 insertions(+), 28 deletions(-) create mode 100644 Tharga.Cache.Blazor/DetailView.razor create mode 100644 plan/feature.md create mode 100644 plan/plan.md diff --git a/Tharga.Cache.Blazor/DetailView.razor b/Tharga.Cache.Blazor/DetailView.razor new file mode 100644 index 0000000..c4e4580 --- /dev/null +++ b/Tharga.Cache.Blazor/DetailView.razor @@ -0,0 +1,125 @@ +@using System.Reflection +@using System.Text.Json +@inject IEternalCache Cache + + + + + Key + @CacheKey + + + Type + @CacheType?.Name + + + + + Created + + + + Updated + + + + Last Accessed + + + + + + Fresh Span + + + + Expires + + + + Load Time + + + + + + Size + @(Info?.Size.ToReadableByteSize() ?? "-") + + + Access Count + @(Info?.AccessCount.ToString() ?? "-") + + + Stale + @(Info?.IsStale.ToString() ?? "-") + + + + + Content + @if (_loading) + { + + } + else + { +
@_json
+ + } +
+
+
+ +@code { + [Parameter] public Type CacheType { get; set; } + [Parameter] public string CacheKey { get; set; } + [Parameter] public CacheItemInfo Info { get; set; } + + private string _json; + private bool _loading = true; + + protected override async Task OnInitializedAsync() + { + await LoadContentAsync(); + } + + private async Task LoadContentAsync() + { + _loading = true; + try + { + if (CacheType == null || string.IsNullOrEmpty(CacheKey)) + { + _json = "(no key/type)"; + return; + } + + var method = typeof(ICache).GetMethod(nameof(ICache.PeekAsync), BindingFlags.Public | BindingFlags.Instance); + if (method == null) + { + _json = "(PeekAsync method not found)"; + return; + } + + var generic = method.MakeGenericMethod(CacheType); + Key key = CacheKey; + var task = (Task)generic.Invoke(Cache, [key]); + await task.ConfigureAwait(false); + var resultProperty = task.GetType().GetProperty("Result"); + var data = resultProperty?.GetValue(task); + + _json = data == null + ? "(no data)" + : JsonSerializer.Serialize(data, new JsonSerializerOptions { WriteIndented = true }); + } + catch (Exception ex) + { + _json = $"(error: {ex.Message})"; + } + finally + { + _loading = false; + } + } +} diff --git a/Tharga.Cache.Blazor/ListView.razor b/Tharga.Cache.Blazor/ListView.razor index ded970c..a964110 100644 --- a/Tharga.Cache.Blazor/ListView.razor +++ b/Tharga.Cache.Blazor/ListView.razor @@ -1,4 +1,6 @@ -@inject ICacheMonitor CacheMonitor +@implements IDisposable +@inject ICacheMonitor CacheMonitor +@inject DialogService DialogService @if (_model == null) { @@ -23,31 +25,11 @@ else @item.Key - - - - - - - - - - - - - - @@ -73,6 +56,11 @@ else @context.Type.Name + + +