1 files changed, 17 insertions, 27 deletions
diff --git a/MatrixRoomUtils.Web/Pages/DevOptions.razor b/MatrixRoomUtils.Web/Pages/DevOptions.razor
index 3ca86b4..0843d5f 100644
--- a/MatrixRoomUtils.Web/Pages/DevOptions.razor
+++ b/MatrixRoomUtils.Web/Pages/DevOptions.razor
@@ -19,15 +19,13 @@
<summary>View caches</summary>
<p>Generic cache:</p>
<ul>
- @foreach (var item in RuntimeCache.GenericResponseCache)
- {
+ @foreach (var item in RuntimeCache.GenericResponseCache) {
<li>
@item.Key: @item.Value.Cache.Count entries<br/>
- @if (item.Value.Cache.Count > 0)
- {
+ @if (item.Value.Cache.Count > 0) {
<p>Earliest expiry: @(item.Value.Cache.Min(x => x.Value.ExpiryTime)) (@string.Format("{0:g}", item.Value.Cache.Min(x => x.Value.ExpiryTime).Value.Subtract(DateTime.Now)) from now)</p>
@* <p>Average expiry: @(item.Value.Cache.Average(x => x.Value.ExpiryTime.Value))(@item.Value.Cache.Average(x => x.Value.ExpiryTime).Value.Subtract(DateTime.Now) from now)</p> *@
- <p>Last expiry: @(item.Value.Cache.Max(x => x.Value.ExpiryTime)) (@string.Format("{0:g}", item.Value.Cache.Max(x => x.Value.ExpiryTime).Value.Subtract(DateTime.Now)) from now)</p>
+ <p>Last expiry: @(item.Value.Cache.Max(x => x.Value.ExpiryTime)) (@string.Format("{0:g}", item.Value.Cache.Max(x => x.Value.ExpiryTime).Value.Subtract(DateTime.Now)) from now)</p>
}
</li>
}
@@ -35,50 +33,42 @@
</details>
@code {
- protected override async Task OnInitializedAsync()
- {
+
+ protected override async Task OnInitializedAsync() {
await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
await base.OnInitializedAsync();
- Task.Run(async () =>
- {
- while (true)
- {
+ Task.Run(async () => {
+ while (true) {
await Task.Delay(1000);
StateHasChanged();
}
});
}
- protected async Task LogStuff()
- {
+ protected async Task LogStuff() {
await Task.Delay(100);
Console.WriteLine($"Settings: {LocalStorageWrapper.Settings.ToJson()}");
-
+
await LocalStorageWrapper.SaveToLocalStorage(LocalStorage);
}
- protected async Task DropCaches()
- {
- foreach (var (key, value) in RuntimeCache.GenericResponseCache)
- {
+ protected async Task DropCaches() {
+ foreach (var (key, value) in RuntimeCache.GenericResponseCache) {
value.Cache.Clear();
}
-
- //RuntimeCache.GenericResponseCache.Clear();
+
+ //RuntimeCache.GenericResponseCache.Clear();
RuntimeCache.HomeserverResolutionCache.Clear();
await LocalStorageWrapper.SaveCacheToLocalStorage(LocalStorage);
}
- protected async Task RandomiseCacheTimers()
- {
- foreach (var keyValuePair in RuntimeCache.GenericResponseCache)
- {
+ protected async Task RandomiseCacheTimers() {
+ foreach (var keyValuePair in RuntimeCache.GenericResponseCache) {
Console.WriteLine($"Randomising cache timer for {keyValuePair.Key}");
- foreach (var cacheItem in keyValuePair.Value.Cache)
- {
+ foreach (var cacheItem in keyValuePair.Value.Cache) {
cacheItem.Value.ExpiryTime = DateTime.Now.AddSeconds(Random.Shared.Next(15, 120));
}
-
+
await LocalStorageWrapper.SaveCacheToLocalStorage(LocalStorage);
}
}
|