Skip to content

Commit 9e9ab08

Browse files
committed
Fix formatting and operator precedence in cache logic
Corrected whitespace in several files for consistency and readability. Fixed operator precedence in CacheStatistics.HitRate property to ensure correct calculation of cache hit rate percentage.
1 parent f6f580e commit 9e9ab08

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Blazouter/Extensions/RouteCacheExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static class RouteCacheExtensions
3333
public static string GetFormattedStatistics(this IRouteCacheService cacheService)
3434
{
3535
CacheStatistics stats = cacheService.GetStatistics();
36-
36+
3737
return $@"Cache Statistics:
3838
Total Requests: {stats.TotalRequests:N0}
3939
Cache Hits: {stats.CacheHits:N0}

src/Blazouter/Models/CacheStatistics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class CacheStatistics
4242
/// A value between 0 and 100 representing the percentage of successful cache hits.
4343
/// Returns 0 if no requests have been made.
4444
/// </value>
45-
public double HitRate => TotalRequests > 0 ? (CacheHits / (double)TotalRequests) * 100 : 0;
45+
public double HitRate => TotalRequests > 0 ? CacheHits / (double)TotalRequests * 100 : 0;
4646

4747
/// <summary>
4848
/// Gets or sets the number of cached route matches currently in memory.

src/Blazouter/Services/CachedRouteMatcherService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public CachedRouteMatcherService(IRouteCacheService cacheService)
9191
// Check if this specific route allows caching
9292
// null means use global settings (cache), false means never cache, true means always cache
9393
bool shouldCache = match.Route?.EnableCache ?? true;
94-
94+
9595
if (shouldCache)
9696
{
9797
_cacheService.CacheRouteMatch(path, match);

src/Blazouter/Services/RouteCacheService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public void Clear()
215215
{
216216
_routeMatchCache.Clear();
217217
_componentTypeCache.Clear();
218-
218+
219219
// Clear the insertion order queue
220220
while (_componentTypeInsertionOrder.TryDequeue(out _))
221221
{

0 commit comments

Comments
 (0)