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 e32920a1..9c86fa4e 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ 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 @@ +