mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-24 03:40:07 +02:00
feat: introduced caching in the server + Added serilog
This commit is contained in:
1 parent
8c9770f8a0
commit
638489a842
25 files changed
+365
-33
No files matched your search
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Logic.Model
|
||||
{
|
||||
public class CacheItem<T>
|
||||
{
|
||||
private const int ExpirationTimeoutInMinutes = 60;
|
||||
private DateTime? _lastRefreshed = null;
|
||||
|
||||
private T? _itemData = default(T);
|
||||
|
||||
public long AccountId { get; set; }
|
||||
|
||||
public bool IsExpired => _lastRefreshed != null &&
|
||||
(DateTime.Now - _lastRefreshed.Value).TotalMinutes > ExpirationTimeoutInMinutes;
|
||||
|
||||
public T? Data
|
||||
{
|
||||
get => _itemData;
|
||||
set
|
||||
{
|
||||
_itemData = value;
|
||||
_lastRefreshed = DateTime.Now;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user