/** * Check if the record is expired. */ boolean isExpired(long now) { return getExpirationTime(100) <= now; }
/** * Check if the record is stale, ie it has outlived * more than half of its TTL. */ boolean isStale(long now) { return getExpirationTime(50) <= now; }
/** * Get the remaining TTL for this record. */ int getRemainingTTL(long now) { return (int) Math.max(0, (getExpirationTime(100) - now) / 1000); }