【发布时间】:2020-05-10 01:59:04
【问题描述】:
这将是一个非常简单的问题,因为我是 Spring-Redis 的新手
我目前正在学习 Redis 数据库,并且正在优先开发一项功能,我不得不使用 Redis 来实现此功能。 在下面的挑战/查询中。
现在我们有一个如下的DataModel:
@RedisHash("Org_Work")
public class OrgWork {
private @Id @Indexed UUID id;
private @Indexed String CorpDetails;
private @Indexed String ContractType;
private @Indexed String ContractAssigned;
private @Indexed String State;
private @Indexed String Country;
}
public interface OrgWorkRepository extends CrudRepository<HoopCalendar, String> {
List<OrgWork> findByCorpDetailsAndContractTypeAndStateAndCountry(String CorpDetails, String ContractType, String ContractAssigned, String State, String Country);
}
我们正在开发一个 API 来查询上述数据模型,前端将向我们发送 CorpDetails 、ContractType、ContractAssigned、State 和 Country 字段,我们必须根据 Redis 数据库查询这些并返回 DurationOfWork 对象。
在这种情况下,我的负载约为。每分钟 100000 次调用。
请让我知道这是否是正确的方法以及一些关于改进响应时间的建议。
***更新了查询
【问题讨论】:
-
查询“CorpDetails ,ContractType, ContractAssigned, State and Country”是否只返回一个结果?我的意思是,我们可以将其视为复合主键吗?或者您的意思是查询这些字段的任意组合?
-
我们希望查询有多个记录。 (查询在 OrdWorkRepository 接口中提到)
标签: java spring-boot redis response-time