Skip to content

Commit 1b60b38

Browse files
committed
- refactoring
1 parent 5071ee5 commit 1b60b38

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

Botticelli.Server.Analytics/Cache/CacheAccessor.cs renamed to Botticelli.Server.Analytics/Cache/LocalCacheAccessor.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
using System.Collections.Concurrent;
2-
using Botticelli.Analytics.Shared.Requests;
1+
using Botticelli.Analytics.Shared.Requests;
32
using Botticelli.Analytics.Shared.Responses;
43
using Botticelli.Server.Analytics.Models;
54
using Botticelli.Server.Analytics.Utils;
6-
using Microsoft.EntityFrameworkCore;
7-
using Microsoft.EntityFrameworkCore.Diagnostics;
85
using Polly;
9-
using Polly.Retry;
6+
using System.Collections.Concurrent;
107

118
namespace Botticelli.Server.Analytics.Cache;
129

13-
14-
public class CacheAccessor : ICacheAccessor
10+
/// <summary>
11+
/// Local-based memory cache with auto-cleaning
12+
/// </summary>
13+
public class LocalCacheAccessor : ICacheAccessor
1514
{
1615
private static readonly ConcurrentDictionary<string, MetricModel> _memoryCache = new();
1716
private static long _maxCacheSize = 1024768;
@@ -58,7 +57,7 @@ private static void RefreshCancellationToken()
5857
_ct = _cancellationTokenSource.Token;
5958
}
6059

61-
public CacheAccessor(long maxCacheSize)
60+
public LocalCacheAccessor(long maxCacheSize)
6261
{
6362
_maxCacheSize = maxCacheSize;
6463
InitCacheCleaning();

Botticelli.Server.Analytics/Extensions/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ public static IServiceCollection AddMetrics(this IServiceCollection services, An
1010
services.AddScoped<MetricsReaderWriter>()
1111
.AddScoped<IMetricsInputService, MetricsInputService>()
1212
.AddScoped<IMetricsOutputService, MetricsOutputService>()
13-
.AddScoped<ICacheAccessor, CacheAccessor>(_ => new CacheAccessor(settings.MaxCacheSize));
13+
.AddScoped<ICacheAccessor, LocalCacheAccessor>(_ => new LocalCacheAccessor(settings.MaxCacheSize));
1414
}

Botticelli.Server.FrontNew/Pages/BotMetrics.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ else
5050
<RadzenText TextStyle="TextStyle.Overline" Text="@metricName"/>
5151
<RadzenChart>
5252
<RadzenLegend Position="LegendPosition.Left"/>
53+
<RadzenColumnOptions Radius="3" Width="10.0" />
5354
<RadzenColumnSeries Data="@_metrics[metricName].Select(x => new
5455
{
5556
DateTime = x.DateTime.ToString("dd.MM.yyyy HH:mm"), x.Value
5657
})"
5758
CategoryProperty="DateTime"
5859
Title="Count"
5960
LineType="LineType.Dashed"
61+
StrokeWidth="0.0"
6062
ValueProperty="Value">
6163
<RadzenSeriesDataLabels Visible="true"/>
6264
</RadzenColumnSeries>

0 commit comments

Comments
 (0)