[英]AEM Lookup Use Case - Design Discussion
Use Case用例
Design-1设计一
Pros - Optimized and efficient - Lower hits on server, entire data (which is not huge) is loaded into In-Memory DOM for quick and intuitive return of search results.优点 - 优化和高效 - 在服务器上的点击率较低,整个数据(不是很大)被加载到内存 DOM 中,以便快速直观地返回搜索结果。
Cons - Search logic which is business logic is implemented client-side.缺点 - 作为业务逻辑的搜索逻辑是在客户端实现的。 In future if there's an Use Case that do something like JCR lookup with the values matched in excel, then it has to be done for entire dataset to return all such fields in JSON.
将来,如果有一个用例使用 excel 中匹配的值执行类似 JCR 查找的操作,则必须对整个数据集执行此操作以返回 JSON 中的所有此类字段。
How does the In-Memory DOM know that the data has been refreshed in the backend? In-Memory DOM 怎么知道数据在后台刷新了呢? On publish, dispatcher will invalidate the JSON response but how will browser DOM know that and update itself?
在发布时,调度程序将使 JSON 响应无效,但浏览器 DOM 如何知道并更新自身?
Design-2设计二
Pros - Search logic which is business logic is implemented server-side.优点 - 作为业务逻辑的搜索逻辑是在服务器端实现的。 More secured.
更有保障。 Data transformation logic resides server-side.
数据转换逻辑驻留在服务器端。 Not huge volume of data in perspective.
数据量不大。
Cons - Less efficient - More hits on server (cache contains json with search term as selector - so the search-term needs to match for the JSON to be returned from cache), page refresh on every search.缺点 - 效率较低 - 服务器上的点击率更高(缓存包含 json,搜索词作为选择器 - 因此搜索词需要匹配 JSON 才能从缓存中返回),每次搜索都会刷新页面。
Which Design would you prefer?您更喜欢哪种设计? Or do you have any other design in mind that would be better?
或者您有其他更好的设计吗?
I would go for option A. Parsing an Excel file is expensive and can add a latency of 1-2 seconds ( No matter which Java Spreadsheet API you are going to use: Apache POI, etc. ).对于选项 A,我会选择 go。解析 Excel 文件的成本很高,并且会增加 1-2 秒的延迟(无论您将使用哪个 Java 电子表格 API:Apache POI 等)。
10K rows is not that many and can be loaded on the client side. 10K 行并不多,可以在客户端加载。
How does the In-Memory DOM know that the data has been refreshed in the backend?
In-Memory DOM 怎么知道数据在后台刷新了呢? On publish, dispatcher will invalidate the JSON response but how will browser DOM know that and update itself?
在发布时,调度程序将使 JSON 响应无效,但浏览器 DOM 如何知道并更新自身?
It depends on your implementation.这取决于您的实施。 You can fetch the spreadheet JSON every time user searches, or you can fetch it once and cache in DOM.
您可以在每次用户搜索时获取电子表格 JSON,也可以获取一次并缓存在 DOM 中。 In the latter case the data will be live until refresh.
在后一种情况下,数据将一直存在直到刷新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.