|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
|
using Myshipping.Core.Entity.CommonDB;
|
|
|
|
@ -22,9 +23,11 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
|
|
|
|
|
{
|
|
|
|
|
private readonly ICache _cache;
|
|
|
|
|
private readonly CacheOptions _cacheOptions;
|
|
|
|
|
private readonly ILogger<SysCacheService> _logger;
|
|
|
|
|
|
|
|
|
|
public SysCacheService(IOptions<CacheOptions> cacheOptions, Func<string, ISingleton, object> resolveNamed)
|
|
|
|
|
public SysCacheService(IOptions<CacheOptions> cacheOptions, ILogger<SysCacheService> logger, Func<string, ISingleton, object> resolveNamed)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_cacheOptions = cacheOptions.Value;
|
|
|
|
|
_cache = resolveNamed(_cacheOptions.CacheType.ToString(), default) as ICache;
|
|
|
|
|
}
|
|
|
|
@ -444,7 +447,8 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public Task SetAllCodeVessel(List<CodeVessel> list)
|
|
|
|
|
{
|
|
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_VESSEL, list);
|
|
|
|
|
_logger.LogInformation("接收到缓存船名");
|
|
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_VESSEL, list.ToJsonString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|