34 lines
905 B
C#
34 lines
905 B
C#
|
using System.Threading;
|
||
|
using System.Threading.Tasks;
|
||
|
using BlueWest.Data.Application;
|
||
|
using Microsoft.Extensions.Hosting;
|
||
|
using Redis.OM;
|
||
|
|
||
|
namespace BlueWest.WebApi
|
||
|
{
|
||
|
public class IndexCreationDevice : IHostedService
|
||
|
{
|
||
|
private readonly RedisConnectionProvider _provider;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Index Creation Device
|
||
|
/// </summary>
|
||
|
/// <param name="provider"></param>
|
||
|
public IndexCreationDevice(RedisConnectionProvider provider)
|
||
|
{
|
||
|
_provider = provider;
|
||
|
}
|
||
|
|
||
|
/// <inheritdoc />
|
||
|
public async Task StartAsync(CancellationToken cancellationToken)
|
||
|
{
|
||
|
await _provider.Connection.CreateIndexAsync(typeof(SessionToken)); }
|
||
|
|
||
|
/// <inheritdoc />
|
||
|
public Task StopAsync(CancellationToken cancellationToken)
|
||
|
{
|
||
|
return Task.CompletedTask; }
|
||
|
}
|
||
|
}
|
||
|
|