From dfe877c438a4f6b61762f4736c492a67631902dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= Date: Wed, 26 Oct 2022 20:08:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Config/SwaggerDoc.xml | 9 +++++- .../Controllers/TestController.cs | 27 +++++++++++++++++- .../yi-sqlsugar-dev.db | Bin 221184 -> 221184 bytes .../Yi.Framework.Core.csproj | 1 + 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index 2fd4751f..e55e98e0 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -529,7 +529,7 @@ 测试控制器 - + 依赖注入 @@ -540,6 +540,7 @@ + @@ -645,5 +646,11 @@ + + + 缓存测试 + + + diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs index a2e327d7..ccfec634 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs @@ -36,6 +36,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers private QuartzInvoker _quartzInvoker; private IHubContext _hub; private ThumbnailSharpInvoer _thumbnailSharpInvoer; + private CacheInvoker _cacheDb; //你可以依赖注入服务层各各接口,也可以注入其他仓储层,怎么爽怎么来! /// /// 依赖注入 @@ -47,7 +48,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// /// /// - public TestController(IHubContext hub, ILogger logger, IRoleService iRoleService, IUserService iUserService, IStringLocalizer local, QuartzInvoker quartzInvoker, ThumbnailSharpInvoer thumbnailSharpInvoer) + /// + public TestController(IHubContext hub, + ILogger logger, + IRoleService iRoleService, + IUserService iUserService, + IStringLocalizer local, + QuartzInvoker quartzInvoker, + ThumbnailSharpInvoer thumbnailSharpInvoer, + CacheInvoker cacheInvoker) { _iUserService = iUserService; _iRoleService = iRoleService; @@ -55,6 +64,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers _hub = hub; _local = local; _thumbnailSharpInvoer = thumbnailSharpInvoer; + _cacheDb = cacheInvoker; } /// @@ -321,5 +331,20 @@ namespace Yi.Framework.ApiMicroservice.Controllers } return Result.Success(); } + + /// + /// 缓存测试 + /// + /// + [HttpGet] + public Result CacheDBTest() + { + var key = "Yi:Test"; + var item = "你好世界"; + _cacheDb.Set(key, item); + + var data = _cacheDb.Get(key); + return Result.Success().SetData(data); + } } } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index e32920a1c7e7995f04b95df2c9f09e205baf6e2b..9c86fa4eea0e25fe1376123f1ffdadcf7d5dc1de 100644 GIT binary patch delta 162 zcmZoTz}s+ucY-vd;zSu|M#aX2tqF`v`~}!}yBYYW^Xu^)<%{9{%-g+LP@tSwB8^Re zO;Ax@Tv40BnE?biME^g(9Og8AeLSN$zkf+aYEgJ*UP^v>v4Ww&^xSwx2_Z8DBLgb~ zBP(M|JtGTKV{A1(^ic_%}1~f8l@5e~bSt{{jBZ+ZBNp^K*dB6JTI#KakJ3 K{XjmG!v_F>6fo}q delta 82 zcmV-Y0ImOkzzu-F4UiiFAdwtH0U&{3wO|3HPYwkQ^8gQ*4=xVH4qOfMvk?&C4Y%`M o0TBWY1rNXg5A+Y`584mS55Th#5UvlCf6oPn#cu((#cu*T@M5JMEC2ui diff --git a/Yi.Framework.Net6/Yi.Framework.Core/Yi.Framework.Core.csproj b/Yi.Framework.Net6/Yi.Framework.Core/Yi.Framework.Core.csproj index 8b54712d..7eae9182 100644 --- a/Yi.Framework.Net6/Yi.Framework.Core/Yi.Framework.Core.csproj +++ b/Yi.Framework.Net6/Yi.Framework.Core/Yi.Framework.Core.csproj @@ -10,6 +10,7 @@ +