asp.net - 用于缓存 API 响应的简单基于 EF 的表花费的时间太长
问题描述
我使用 EF 构建了一个简单的表,用于在我的 ASP.net Web 应用程序中缓存一些 API 请求,以便我可以提高发出相同 REST 调用的请求的性能。
该表有 4 行测试数据。当我在 SQL Server Management Studio 中对所有列进行简单的 SELECT 查询时,加载需要 5-7 秒。如果我在 SELECT 查询中跳过“CachedData”,它会立即加载。我可以做些什么来提高我的表现。我知道 CachedData 可以是大的 JSON 字符串,但我之前看到过更长的字符串在其他表中工作得更快。我错过了什么吗?
这是我的对象/表结构 -
public class APIDataCache
{
//Using Composite keys.
[Key]
[Column(Order = 1)]
public string TransactID { get; set; } //nvarchar(128), Not Null
[Key]
[Column(Order = 2)]
public string ResourceID { get; set; } //nvarchar(128), Not Null
[Key]
[Column(Order = 3)]
public string APIDataLevel { get; set; } //nvarchar(128), Not Null
public string CachedData { get; set; } //nvarchar(max), Nullable
public DateTime CachedAtTime { get; set; }//datetime, Not Null
}
解决方案
推荐阅读
- qt - Qt5主窗口隐藏总是返回true
- node.js - 从节点到 MariaDB 连接器的带有 IN 条件的 SELECT 查询始终返回单行
- c# - 从 c# 添加 th 单元格
- salesforce - 是否有可能仅在特定条件下使我的 visualforce 页面在 visualforce 组件中可见
- php - php中的Mailshake API集成
- angular - 如何将选定的下拉值传递给组件
- html - 在 CSS 中使用根元素和 rem 缩放字体
- python - 点击使用 Selenium 的一系列问题——无法通过第一个问题
- azure - Azure Monitor / Application Insights 未显示错误堆栈跟踪
- php - gRPC 在终端中工作,但不在 laravel 项目中