[MGNLSTK-1294] AbstractItemListModel should cache query result Created: 25/Nov/13 Updated: 02/Jul/18 Resolved: 02/Jul/18 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | None |
| Affects Version/s: | 2.7 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Tobias Mattsson | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Date of First Response: |
| Description |
|
When displaying event overview or event calendar the query to find event pages is executed unnecessarily often. In calendar.ftl each item is rendered along with its css and link, each time one of those attributes is touched the query is executed again. The link appears twice in the markup so for each item the query is executed 3 times. Making the number of queries executed be: 1 + number_of_hits*3. AbstractItemListModel is used by more than just calendar.ftl. Adding caching in AbstractItemListModel#getItems can significantly improve the performance. A condition could be added to only cache if the result is not larger than a predefined limit. A simple test with the following change reduced the time to run the integration tests by 47 seconds on machine, a reduction of 17%.
private List<Node> itemsList = null;
public Collection<Node> getItems() throws RepositoryException {
if (itemsList != null)
return itemsList;
itemsList = search();
|
| Comments |
| Comment by Jan Haderka [ 02/Jul/18 ] |
|
STK have been deprecated in September 2017. As part of this project nearing end-of-life, we are not planning to fix any of the existing issues except for the critical security issues. For more details, please consult documentation. |