SeemGen/Services/CacheService.cs

44 lines
1.6 KiB
C#

using BLAIzor.Models;
namespace BLAIzor.Services
{
public class CacheService
{
private readonly WebsiteContentLoaderService _websiteContentLoaderService;
private readonly ISimpleLogger _logger;
private readonly ScopedContentService _scopedContentService;
private readonly ContentEditorService _contentEditorService;
private readonly QDrantService _qDrantService;
public CacheService(
WebsiteContentLoaderService websiteContentLoaderService,
ISimpleLogger logger,
ScopedContentService scopedContentService,
ContentEditorService contentEditorService,
QDrantService qDrantService
)
{
_websiteContentLoaderService = websiteContentLoaderService;
_logger = logger;
_scopedContentService = scopedContentService;
_contentEditorService = contentEditorService;
_qDrantService = qDrantService;
}
public async Task<WebsiteContentModel> UpdateContentCache(string sessionId, int siteId)
{
await _logger.InfoAsync($"UpdateCache: method called", $"sessionId: {sessionId}, siteId: {siteId}");
SiteInfo site = await _contentEditorService.GetSiteInfoByIdAsync(siteId);
WebsiteContentModel siteModel = null;
siteModel = await _websiteContentLoaderService.LoadAllAsync(
site,
_qDrantService.GetPointsFromQdrantAsyncByPointIds
);
_scopedContentService.WebsiteContentModel = siteModel;
return siteModel;
}
}
}