Interface HomeStatsService
- All Known Implementing Classes:
HomeStatsServiceImpl
Reads are anonymous-safe; the snapshot represents only what an anonymous user would see.
No method-level @Secured guards intentionally — the security boundary is the REST
surface (POST /stats/home/refresh carries
@PreAuthorize("hasAuthority('GROUP_ADMIN')")), and the HomeStatsRefresher
background thread invokes refresh() without a SecurityContext (the startup
lifecycle event doesn't propagate one, and adding one would require an authenticate-as-
agent dance for the dev container). Instead, the impl sets up an anonymous SecurityContext
internally for the actual data reads, so the snapshot still represents only what an
anonymous user would see. Call-site discipline keeps this safe — only the REST endpoint
and the refresher itself call this.
-
Method Summary
-
Method Details
-
getCached
Return the most-recent snapshot, loading from disk on first access. Returnsnullonly if nothing has ever been generated AND the disk cache is missing — the REST layer should handle that as a 503 rather than synchronously building the snapshot under request load. -
refresh
HomeStats refresh()Recompute the snapshot from scratch (anonymous-user perspective), persist to disk, and update the in-memory cache.
-