You can cachorize the results for the specified time. When multiple users view the same summary view, processing can be speeded up by omitting calculation processing.

Outline and effect of this function

In the summary view, all data of the target model is read once when the screen is opened.For this reason, it takes time to compile large amounts of data.
In order to improve this, we have prepared a function to cache the results once aggregated for a specified time.

This function saves the totaled result in memory.When another user opens the tabulation view within the cache validity period, it uses the calculated result, so it can improve the processing speed on the experience.

How to write a repository

Enter the number in "Validity period of cache".The unit can be selected from "seconds" "minute" "hour" "day" "month" year ".

Figure 1 Cache settings

In the model where data is registered or updated at any time, the situation that the result displayed in the summary view is not the latest happens.Adjusting the effective danger of the cache makes it possible to balance the number of calculations for aggregation with the freshness of the data.

Even if it is within the specified cache validity period, if the application is restarted, the totaled result is erased from memory.

Cache key

The cache is prepared for each search condition.Therefore, if the search conditions are the same, the cache is valid, but it will not be cached if the search conditions are different.