47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using StackExchange.Redis;
|
|
|
|
|
|
using ServerCore;
|
|
|
|
|
|
namespace ServerBase;
|
|
|
|
public class ServerMetricsManager : Singleton<ServerMetricsManager>
|
|
{
|
|
public static readonly int KEEP_SERVER_UPDATE_INTERVAL_MSEC = (10 * 1000);
|
|
|
|
private ServerMetricsCacheRequest? m_server_Metrics_handler;
|
|
private ConcurrentDictionary<string, ServerMetricsCacheRequest.CacheServerKey> m_cache_server_keys = new();
|
|
|
|
private bool m_is_setup_completed = false;
|
|
|
|
public Result setup(RedisConnector redisConnector)
|
|
{
|
|
var result = new Result();
|
|
|
|
m_server_Metrics_handler = new ServerMetricsHandler(this, redisConnector);
|
|
|
|
m_is_setup_completed = true;
|
|
|
|
return result;
|
|
}
|
|
|
|
public ServerMetricsCacheRequest getServerMetricsCacheRequest()
|
|
{
|
|
NullReferenceCheckHelper.throwIfNull(m_server_Metrics_handler, () => $"found_request is null !!!");
|
|
return m_server_Metrics_handler;
|
|
}
|
|
|
|
public bool isSetupCompleted() => m_is_setup_completed;
|
|
|
|
public ConcurrentDictionary<string, ServerMetricsCacheRequest.CacheServerKey> getCacheServers() => m_cache_server_keys;
|
|
}
|