Update dashboard statistics caching and retrieval logic
continuous-integration/drone/push Build is passing

- Increased the cache duration for dashboard statistics from 60 seconds to 5 minutes, improving data freshness and reducing load on the backend.
- Introduced a stale cache mechanism that allows retrieval of stale statistics while refreshing them in the background, enhancing user experience by providing quicker access to data.
- Updated the statistics repository to handle the new caching logic, ensuring accurate and timely statistics reporting.
- Added tests to validate the new caching behavior and ensure the integrity of statistics retrieval.

This update optimizes the dashboard's performance and responsiveness by improving the caching strategy for statistics.
This commit is contained in:
Mazyar
2026-06-30 18:50:47 +03:30
parent 7aacb7dfc9
commit 3002935b76
4 changed files with 154 additions and 41 deletions
+1 -1
View File
@@ -181,7 +181,7 @@ func (h *Handler) Statistics(c echo.Context) error {
return response.InternalServerError(c, "Failed to load dashboard statistics")
}
setPrivateCache(c, 60)
setPrivateCache(c, 300)
return response.Success(c, out, "Dashboard statistics retrieved successfully")
}