updating cache when a new recitation is published ot and existing one is modified or deleted

This commit is contained in:
Hamid Reza Mohammadi 2021-05-18 10:59:48 +04:30
parent 76184882f7
commit 4b6f57b3af
2 changed files with 26 additions and 2 deletions

View File

@ -8506,7 +8506,12 @@
memory cache
</summary>
</member>
<member name="M:RMuseum.Services.Implementationa.RecitationService.#ctor(RMuseum.DbContext.RMuseumDbContext,Microsoft.Extensions.Configuration.IConfiguration,RSecurityBackend.Services.IBackgroundTaskQueue,RSecurityBackend.Services.IRNotificationService,RSecurityBackend.Services.IAppUserService,Microsoft.Extensions.Caching.Memory.IMemoryCache)">
<member name="F:RMuseum.Services.Implementationa.RecitationService._ganjoorService">
<summary>
ganjoor service
</summary>
</member>
<member name="M:RMuseum.Services.Implementationa.RecitationService.#ctor(RMuseum.DbContext.RMuseumDbContext,Microsoft.Extensions.Configuration.IConfiguration,RSecurityBackend.Services.IBackgroundTaskQueue,RSecurityBackend.Services.IRNotificationService,RSecurityBackend.Services.IAppUserService,Microsoft.Extensions.Caching.Memory.IMemoryCache,RMuseum.Services.IGanjoorService)">
<summary>
constructor
</summary>
@ -8516,6 +8521,7 @@
<param name="notificationService"></param>
<param name="userService"></param>
<param name="memoryCache"></param>
<param name="ganjoorService"></param>
</member>
<member name="T:RMuseum.Services.IMusicCatalogueService">
<summary>

View File

@ -249,6 +249,8 @@ namespace RMuseum.Services.Implementationa
$"خوانش ارسالی {audioTitle} حذف شد.{Environment.NewLine}" +
$"می‌توانید با مراجعه به <a href=\"https://ganjoor.net/?p={GanjoorPostId}\">این صفحه</a> وضعیت آن را بررسی کنید."
);
await _ganjoorService.CacheCleanForPageById(GanjoorPostId);
}
else
{
@ -459,6 +461,8 @@ namespace RMuseum.Services.Implementationa
await UpdateRecitation(narration, true);
await _ganjoorService.CacheCleanForPageById(narration.GanjoorPostId);
}
return new RServiceResult<RecitationViewModel>(new RecitationViewModel(narration, narration.Owner, await _context.GanjoorPoems.Where(p => p.Id == narration.GanjoorPostId).SingleOrDefaultAsync()));
}
@ -1077,6 +1081,9 @@ namespace RMuseum.Services.Implementationa
$"خوانش ارسالی {narration.AudioTitle} منتشر شد.{Environment.NewLine}" +
$"می‌توانید با مراجعه به <a href=\"https://ganjoor.net/?p={narration.GanjoorPostId}\">این صفحه</a> وضعیت آن را بررسی کنید."
);
await _ganjoorService.CacheCleanForPageById(narration.GanjoorPostId);
}
return new RServiceResult<RecitationViewModel>(new RecitationViewModel(narration, narration.Owner, await _context.GanjoorPoems.Where(p => p.Id == narration.GanjoorPostId).SingleOrDefaultAsync()));
@ -1742,6 +1749,8 @@ namespace RMuseum.Services.Implementationa
await UpdateRecitation(other, false /* owner of this recitation did nothing to expect any notifications*/);
await _ganjoorService.CacheCleanForPageById(other.GanjoorPostId);
}
recitation.AudioOrder = 1;
@ -1749,6 +1758,8 @@ namespace RMuseum.Services.Implementationa
_context.Recitations.Update(recitation);
await UpdateRecitation(recitation, true);
await _ganjoorService.CacheCleanForPageById(recitation.GanjoorPostId);
}
@ -1838,6 +1849,11 @@ namespace RMuseum.Services.Implementationa
/// </summary>
private readonly IMemoryCache _memoryCache;
/// <summary>
/// ganjoor service
/// </summary>
private readonly IGanjoorService _ganjoorService;
/// <summary>
/// constructor
@ -1848,7 +1864,8 @@ namespace RMuseum.Services.Implementationa
/// <param name="notificationService"></param>
/// <param name="userService"></param>
/// <param name="memoryCache"></param>
public RecitationService(RMuseumDbContext context, IConfiguration configuration, IBackgroundTaskQueue backgroundTaskQueue, IRNotificationService notificationService, IAppUserService userService, IMemoryCache memoryCache)
/// <param name="ganjoorService"></param>
public RecitationService(RMuseumDbContext context, IConfiguration configuration, IBackgroundTaskQueue backgroundTaskQueue, IRNotificationService notificationService, IAppUserService userService, IMemoryCache memoryCache, IGanjoorService ganjoorService)
{
_context = context;
Configuration = configuration;
@ -1856,6 +1873,7 @@ namespace RMuseum.Services.Implementationa
_notificationService = notificationService;
_userService = userService;
_memoryCache = memoryCache;
_ganjoorService = ganjoorService;
}
}
}