feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) + game logic (GameFix/GameDAL/ServerData) + network layer (NetWorkMessage) + data layer (ObjectModel) + utilities (MrWu/Core/Config/CloudAPI/dll) + adapters (zyxAdapter/base) .NET 8.0 C# solution, 16 projects, 958 source files
This commit is contained in:
37
CloudAPI/Cloud/Alibaba/SLS/SlsClient.cs
Normal file
37
CloudAPI/Cloud/Alibaba/SLS/SlsClient.cs
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using Aliyun.Api.LogService;
|
||||
using Cloud.Alibaba.Oss;
|
||||
|
||||
namespace Cloud.Alibaba.Sls
|
||||
{
|
||||
public class ClientManager
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, ILogServiceClient> ClientCache = new ConcurrentDictionary<string, ILogServiceClient>();
|
||||
|
||||
public static ILogServiceClient GetClient(Account account, SlsProject project)
|
||||
{
|
||||
string cacheKey = GetCacheKey(account, project);
|
||||
|
||||
ILogServiceClient result = ClientCache.GetOrAdd(cacheKey, (key) =>
|
||||
{
|
||||
AccountConfig accountConfig = AccountConfig.GetConfig(account);
|
||||
SlsProjectConfig projectConfig = SlsProjectConfig.GetConfig(project);
|
||||
|
||||
return LogServiceClientBuilders.HttpBuilder
|
||||
.Endpoint(projectConfig.Endpoint, projectConfig.ProjectName)
|
||||
.Credential(accountConfig.AccessKey, accountConfig.SecretKey)
|
||||
.Build();
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetCacheKey(Account account, SlsProject project)
|
||||
{
|
||||
return $"{account}_{project}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user