缓存测试
This commit is contained in:
@@ -529,7 +529,7 @@
|
|||||||
测试控制器
|
测试控制器
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.#ctor(Microsoft.AspNetCore.SignalR.IHubContext{Yi.Framework.WebCore.SignalRHub.MainHub},Microsoft.Extensions.Logging.ILogger{Yi.Framework.Model.Models.UserEntity},Yi.Framework.Interface.IRoleService,Yi.Framework.Interface.IUserService,Microsoft.Extensions.Localization.IStringLocalizer{Yi.Framework.Language.LocalLanguage},Yi.Framework.Core.QuartzInvoker,Yi.Framework.Core.ThumbnailSharpInvoer)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.#ctor(Microsoft.AspNetCore.SignalR.IHubContext{Yi.Framework.WebCore.SignalRHub.MainHub},Microsoft.Extensions.Logging.ILogger{Yi.Framework.Model.Models.UserEntity},Yi.Framework.Interface.IRoleService,Yi.Framework.Interface.IUserService,Microsoft.Extensions.Localization.IStringLocalizer{Yi.Framework.Language.LocalLanguage},Yi.Framework.Core.QuartzInvoker,Yi.Framework.Core.ThumbnailSharpInvoer,Yi.Framework.Core.CacheInvoker)">
|
||||||
<summary>
|
<summary>
|
||||||
依赖注入
|
依赖注入
|
||||||
</summary>
|
</summary>
|
||||||
@@ -540,6 +540,7 @@
|
|||||||
<param name="local"></param>
|
<param name="local"></param>
|
||||||
<param name="quartzInvoker"></param>
|
<param name="quartzInvoker"></param>
|
||||||
<param name="thumbnailSharpInvoer"></param>
|
<param name="thumbnailSharpInvoer"></param>
|
||||||
|
<param name="cacheInvoker"></param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.Swagger">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.Swagger">
|
||||||
<summary>
|
<summary>
|
||||||
@@ -645,5 +646,11 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.CacheDBTest">
|
||||||
|
<summary>
|
||||||
|
缓存测试
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
private QuartzInvoker _quartzInvoker;
|
private QuartzInvoker _quartzInvoker;
|
||||||
private IHubContext<MainHub> _hub;
|
private IHubContext<MainHub> _hub;
|
||||||
private ThumbnailSharpInvoer _thumbnailSharpInvoer;
|
private ThumbnailSharpInvoer _thumbnailSharpInvoer;
|
||||||
|
private CacheInvoker _cacheDb;
|
||||||
//你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
|
//你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来!
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 依赖注入
|
/// 依赖注入
|
||||||
@@ -47,7 +48,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <param name="local"></param>
|
/// <param name="local"></param>
|
||||||
/// <param name="quartzInvoker"></param>
|
/// <param name="quartzInvoker"></param>
|
||||||
/// <param name="thumbnailSharpInvoer"></param>
|
/// <param name="thumbnailSharpInvoer"></param>
|
||||||
public TestController(IHubContext<MainHub> hub, ILogger<UserEntity> logger, IRoleService iRoleService, IUserService iUserService, IStringLocalizer<LocalLanguage> local, QuartzInvoker quartzInvoker, ThumbnailSharpInvoer thumbnailSharpInvoer)
|
/// <param name="cacheInvoker"></param>
|
||||||
|
public TestController(IHubContext<MainHub> hub,
|
||||||
|
ILogger<UserEntity> logger,
|
||||||
|
IRoleService iRoleService,
|
||||||
|
IUserService iUserService,
|
||||||
|
IStringLocalizer<LocalLanguage> local,
|
||||||
|
QuartzInvoker quartzInvoker,
|
||||||
|
ThumbnailSharpInvoer thumbnailSharpInvoer,
|
||||||
|
CacheInvoker cacheInvoker)
|
||||||
{
|
{
|
||||||
_iUserService = iUserService;
|
_iUserService = iUserService;
|
||||||
_iRoleService = iRoleService;
|
_iRoleService = iRoleService;
|
||||||
@@ -55,6 +64,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
_hub = hub;
|
_hub = hub;
|
||||||
_local = local;
|
_local = local;
|
||||||
_thumbnailSharpInvoer = thumbnailSharpInvoer;
|
_thumbnailSharpInvoer = thumbnailSharpInvoer;
|
||||||
|
_cacheDb = cacheInvoker;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -321,5 +331,20 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
}
|
}
|
||||||
return Result.Success();
|
return Result.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存测试
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public Result CacheDBTest()
|
||||||
|
{
|
||||||
|
var key = "Yi:Test";
|
||||||
|
var item = "你好世界";
|
||||||
|
_cacheDb.Set(key, item);
|
||||||
|
|
||||||
|
var data = _cacheDb.Get<string>(key);
|
||||||
|
return Result.Success().SetData(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -10,6 +10,7 @@
|
|||||||
<PackageReference Include="CSRedisCore" Version="3.6.9" />
|
<PackageReference Include="CSRedisCore" Version="3.6.9" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
||||||
|
|||||||
Reference in New Issue
Block a user