Files
Atomx/Atomx.Core/Jos/LocalizationJob.cs
2025-12-12 16:18:27 +08:00

36 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Hangfire;
using Microsoft.Extensions.Logging;
namespace Atomx.Core.Jos
{
/// <summary>
/// 多语言本地化任务
/// </summary>
public class LocalizationJob
{
readonly ILogger<LocalizationJob> _logger;
public LocalizationJob(ILogger<LocalizationJob> logger)
{
_logger = logger;
}
/// <summary>
/// 如果任务失败,重试 3 次超过后删除任务60 秒内不允许并发执行
/// </summary>
[AutomaticRetry(Attempts = 3, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
[DisableConcurrentExecution(60)]
public void Execute(string path)
{
_logger.LogInformation("LocalizationJob executed at: {time}", DateTimeOffset.Now);
// 在这里添加多语言本地化的具体任务逻辑
}
public void ResetCache()
{
_logger.LogInformation("LocalizationJob ResetCache executed at: {time}", DateTimeOffset.Now);
// 在这里添加重置缓存的具体逻辑
}
}
}