그리드 표현 일부 완료. 데이터 검측 필수 예정
This commit is contained in:
40
SchemaEditor/Services/GarnetHost.cs
Normal file
40
SchemaEditor/Services/GarnetHost.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Garnet;
|
||||
|
||||
namespace SchemaEditor.Services;
|
||||
|
||||
public class GarnetHost : IHostedService, IDisposable
|
||||
{
|
||||
private GarnetServer? _server;
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var serverArgs = new string[] { "--port", "3187" }; // Changed to 3187
|
||||
_server = new GarnetServer(serverArgs);
|
||||
_server.Start();
|
||||
Console.WriteLine("[GarnetHost] Server started on port 3278");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"[GarnetHost] Failed to start: {ex.Message}");
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_server?.Dispose();
|
||||
Console.WriteLine("[GarnetHost] Server stopped");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_server?.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user