Class ApplicationBadgeStorage

java.lang.Object
io.meeds.appcenter.storage.ApplicationBadgeStorage

@Component public class ApplicationBadgeStorage extends Object
Caches badge counts per badgeName:username.

sync = true is what keeps the same badge — displayed simultaneously on the launcher card, the "My Applications" tile and the pinned topbar button — from being computed several times at once. It only holds because KernelCacheManagerAdapter delegates to FutureExoCache; without that, concurrent misses each run the loader.

The cache TTL doubles as a safety net: it bounds staleness for a source that cannot push, it self-heals an eviction that was missed (dropped WebSocket frame, swallowed listener exception), and it bounds how long a cluster node that missed an eviction can serve a stale value.

  • Field Details

  • Constructor Details

    • ApplicationBadgeStorage

      public ApplicationBadgeStorage()
  • Method Details

    • getBadge

      @Cacheable(cacheNames="app-center.badge", key="#p0 + \':\' + #p1", sync=true) public long getBadge(String badgeName, String username)
      Returns the cached count for a badge, computing it through the contributing plugin on a miss.
      Parameters:
      badgeName - the badge identifier
      username - the user the count is computed for
      Returns:
      the count, 0 when no plugin is registered under that name
    • evict

      @CacheEvict(cacheNames="app-center.badge", key="#p0 + \':\' + #p1") public void evict(String badgeName, String username)
      Drops the cached count so that the next read recomputes it. Must run before the frontend is notified, otherwise the browser re-fetches the very value it was told to refresh.
      Parameters:
      badgeName - the badge identifier
      username - the user whose count changed