java.lang.Object
net.i2p.router.web.helpers.NetDbRouterCache
Cached snapshot of the network database sorted by
RouterInfoComparator. The /netdb page auto-refreshes every 10 seconds (netdb.js REFRESH_INTERVAL_SHORT), so a snapshot up to this age is never visible to a client; caching it avoids re-sorting the full network database on every render.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static List<RouterInfo> The routers read last time.private final RouterContextThe router whose netdb is read.private static longWhen the cached list stops being usable.private static final longHow long the router list is reused - 10 seconds.Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionSnapshot of the network database sorted by RouterInfoComparator, cached for the /netdb auto-refresh period.
Field Details
NETDB_REFRESH_PERIOD
private static final long NETDB_REFRESH_PERIODHow long the router list is reused - 10 seconds.- See Also:
_routersCachedUntil
private static volatile long _routersCachedUntilWhen the cached list stops being usable._cachedRouters
The routers read last time._context
The router whose netdb is read.
Constructor Details
NetDbRouterCache
Method Details
getSortedRouters
Snapshot of the network database sorted by RouterInfoComparator, cached for the /netdb auto-refresh period.- Returns:
- every known RouterInfo in comparator order; never null, but may be empty before the router has learned about any peers