这将是一个非常基本的问题,因为我是 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;
}
Run Code Online (Sandbox Code Playgroud)
public interface OrgWorkRepository extends CrudRepository<HoopCalendar, String> {
List<OrgWork> findByCorpDetailsAndContractTypeAndStateAndCountry(String CorpDetails, String ContractType, String ContractAssigned, String State, String Country);
}
Run Code Online (Sandbox Code Playgroud)
我们正在开发一个 API 来查询上述数据模型,其中前端将向我们发送 CorpDetails、ContractType、ContractAssigned、State 和 Country 字段,我们必须针对 Redis 数据库查询这些字段并返回 DurationOfWork 对象。
在这种情况下,我将有大约的负载。每分钟 100000 个呼叫。
请告诉我这是否是正确的方法以及一些关于缩短响应时间的建议。
***更新了查询
我试图在 mongo 中保存List< LocalDate >(只是yyyy-MM-dd格式的没有时间的日期),在我的 API 完成 dateList 的计算后,我试图将这些日期保存在 MongoDB 中。保存后,我看到日期以yyyy-MM-dd hh:mm:ss格式保存,如下所示。
有人可以让我知道为什么会这样吗?有没有办法只以 yyyy-MM-dd 格式保存 LocalDate?非常感谢。
我将 SpringJPA Mongo 与 springboot 和 Java 一起使用。