public boolean shouldInvoke ( C context ) { cleanupExpiredSuppressions ( ) ; if ( cache . containsKey ( context ) ) return false ; Suppression < C > suppression = new Suppression <> ( ticker , context , ticker . read ( ) + ttlNanos ) ; if ( cache . putIfAbsent ( context , suppression ) != null ) return false ; // lost race suppressions . offer ( suppression ) ; // If we added an entry, it could make us go over the max size. if ( suppressions . size ( ) > cardinality ) removeOneSuppression ( ) ; return true ; }
Returns true if a given context should be invoked .